From 02afd8a32edb13ea7fc2266ac80092ea15c0930c Mon Sep 17 00:00:00 2001 From: Alvin Li Date: Wed, 9 Oct 2013 15:52:53 +0800 Subject: * treat 'apps/utils' as regular django app; which used to store general tools for used in other apps * moved 'templatetags' from 'apps/indicator' to 'apps/utils' * '.gitignore' to ignore 'fixtures_bak' * moved js plugins from 'apps/indicator/static/plugins' to 'staticfiles/plugins' apps/recommend: * updated 'recommend.models'; o commented 'recommend.models.ResearchCombination' (not used) * implemented views 'add_edit_blog_info' and 'ajax_add_edit_configs'; * added pages 'templates/recommend/add_edit_blog_info.html', 'add_edit_blog_info_error.html'; o related css and javascripts files * added 'tools.py'; * added 'utils/tools.py' for placing generic functions; * deleted 'initial_data.json' (mv 'fixtures' to 'fixtures_bak'); * small fixes to 'indicator.models', 'sciblog.models' and 'sfaccount.views' * fixed automatically show 'proper_nouns' annotation in blog: recovered the line 'import signals' in 'sciblog.models' * added 'is_ok()' method for 'recommend.models.ResearchConfig'; --- .../plugins/jquery-ui/tests/unit/core/all.html | 30 +++ .../plugins/jquery-ui/tests/unit/core/core.html | 135 +++++++++++ .../plugins/jquery-ui/tests/unit/core/core.js | 185 +++++++++++++++ .../plugins/jquery-ui/tests/unit/core/selector.js | 251 +++++++++++++++++++++ 4 files changed, 601 insertions(+) create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/all.html create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/core.html create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/core.js create mode 100644 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/selector.js (limited to '97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core') diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/all.html b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/all.html new file mode 100644 index 0000000..2e2d863 --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/all.html @@ -0,0 +1,30 @@ + + + + + jQuery UI Core Test Suite + + + + + + + + + + + + + +

jQuery UI Core Test Suite

+

+
+

+
    +
    + +
    + + diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/core.html b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/core.html new file mode 100644 index 0000000..41c8db8 --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/core.html @@ -0,0 +1,135 @@ + + + + + jQuery UI Core Test Suite + + + + + + + + + + + + + + + + +

    jQuery UI Core Test Suite

    +

    +
    +

    +
      +
      + + + + + + + + + + +
      +
      + +
      + + + + + + + + + + xxx + anchor + anchor + x +
      x
      + x +
      x
      +
      + +
      + + + + + + + + + +
      + +
      + + + + + + + + + +
      + +
      + + + + + + . + . + . + . +
      + +
      + + +
      + +
      +
      .
      +
      +
      +
      .
      +
      +
      +
      .
      +
      +
      + +
      + +
      + + diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/core.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/core.js new file mode 100644 index 0000000..78a2253 --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/core.js @@ -0,0 +1,185 @@ +(function( $ ) { + +module( "core - jQuery extensions" ); + +TestHelpers.testJshint( "core" ); + +asyncTest( "focus - original functionality", function() { + expect( 1 ); + $( "#inputTabindex0" ) + .one( "focus", function() { + ok( true, "event triggered" ); + start(); + }) + .focus(); +}); + +asyncTest( "focus", function() { + expect( 2 ); + $( "#inputTabindex0" ) + .one( "focus", function() { + ok( true, "event triggered" ); + start(); + }) + .focus( 500, function() { + ok( true, "callback triggered" ); + }); +}); + +test( "zIndex", function() { + expect( 7 ); + var el = $( "#zIndexAutoWithParent" ), + parent = el.parent(); + equal( el.zIndex(), 100, "zIndex traverses up to find value" ); + equal( parent.zIndex(200 ), parent, "zIndex setter is chainable" ); + equal( el.zIndex(), 200, "zIndex setter changed zIndex" ); + + el = $( "#zIndexAutoWithParentViaCSS" ); + equal( el.zIndex(), 0, "zIndex traverses up to find CSS value, not found because not positioned" ); + + el = $( "#zIndexAutoWithParentViaCSSPositioned" ); + equal( el.zIndex(), 100, "zIndex traverses up to find CSS value" ); + el.parent().zIndex( 200 ); + equal( el.zIndex(), 200, "zIndex setter changed zIndex, overriding CSS" ); + + equal( $( "#zIndexAutoNoParent" ).zIndex(), 0, "zIndex never explicitly set in hierarchy" ); +}); + +test( "innerWidth - getter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + equal( el.innerWidth(), 122, "getter passthru" ); + el.hide(); + equal( el.innerWidth(), 122, "getter passthru when hidden" ); +}); + +test( "innerWidth - setter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + el.innerWidth( 120 ); + equal( el.width(), 98, "width set properly" ); + el.hide(); + el.innerWidth( 100 ); + equal( el.width(), 78, "width set properly when hidden" ); +}); + +test( "innerHeight - getter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + equal( el.innerHeight(), 70, "getter passthru" ); + el.hide(); + equal( el.innerHeight(), 70, "getter passthru when hidden" ); +}); + +test( "innerHeight - setter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + el.innerHeight( 60 ); + equal( el.height(), 40, "height set properly" ); + el.hide(); + el.innerHeight( 50 ); + equal( el.height(), 30, "height set properly when hidden" ); +}); + +test( "outerWidth - getter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + equal( el.outerWidth(), 140, "getter passthru" ); + el.hide(); + equal( el.outerWidth(), 140, "getter passthru when hidden" ); +}); + +test( "outerWidth - setter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + el.outerWidth( 130 ); + equal( el.width(), 90, "width set properly" ); + el.hide(); + el.outerWidth( 120 ); + equal( el.width(), 80, "width set properly when hidden" ); +}); + +test( "outerWidth(true) - getter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + equal( el.outerWidth(true), 154, "getter passthru w/ margin" ); + el.hide(); + equal( el.outerWidth(true), 154, "getter passthru w/ margin when hidden" ); +}); + +test( "outerWidth(true) - setter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + el.outerWidth( 130, true ); + equal( el.width(), 76, "width set properly" ); + el.hide(); + el.outerWidth( 120, true ); + equal( el.width(), 66, "width set properly when hidden" ); +}); + +test( "outerHeight - getter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + equal( el.outerHeight(), 86, "getter passthru" ); + el.hide(); + equal( el.outerHeight(), 86, "getter passthru when hidden" ); +}); + +test( "outerHeight - setter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + el.outerHeight( 80 ); + equal( el.height(), 44, "height set properly" ); + el.hide(); + el.outerHeight( 70 ); + equal( el.height(), 34, "height set properly when hidden" ); +}); + +test( "outerHeight(true) - getter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + equal( el.outerHeight(true), 98, "getter passthru w/ margin" ); + el.hide(); + equal( el.outerHeight(true), 98, "getter passthru w/ margin when hidden" ); +}); + +test( "outerHeight(true) - setter", function() { + expect( 2 ); + var el = $( "#dimensions" ); + + el.outerHeight( 90, true ); + equal( el.height(), 42, "height set properly" ); + el.hide(); + el.outerHeight( 80, true ); + equal( el.height(), 32, "height set properly when hidden" ); +}); + +test( "uniqueId / removeUniqueId", function() { + expect( 3 ); + var el = $( "img" ).eq( 0 ); + + // support: jQuery <1.6.2 + // support: IE <8 + // We should use strictEqual( id, undefined ) when dropping jQuery 1.6.1 support (or IE6/7) + ok( !el.attr( "id" ), "element has no initial id" ); + el.uniqueId(); + ok( /ui-id-\d+$/.test( el.attr( "id" ) ), "element has generated id" ); + el.removeUniqueId(); + // support: jQuery <1.6.2 + // support: IE <8 + // see above + ok( !el.attr( "id" ), "unique id has been removed from element" ); +}); + +})( jQuery ); diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/selector.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/selector.js new file mode 100644 index 0000000..f86526b --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/core/selector.js @@ -0,0 +1,251 @@ +/* + * selector unit tests + */ +(function($) { + +module("core - selectors"); + +function isFocusable(selector, msg) { + QUnit.push($(selector).is(":focusable"), null, null, msg + " - selector " + selector + " is focusable"); +} + +function isNotFocusable(selector, msg) { + QUnit.push($(selector).length && !$(selector).is(":focusable"), null, null, msg + " - selector " + selector + " is not focusable"); +} + +function isTabbable(selector, msg) { + QUnit.push($(selector).is(":tabbable"), null, null, msg + " - selector " + selector + " is tabbable"); +} + +function isNotTabbable(selector, msg) { + QUnit.push($(selector).length && !$(selector).is(":tabbable"), null, null, msg + " - selector " + selector + " is not tabbable"); +} + +test("data", function() { + expect(15); + + var el; + function shouldHaveData(msg) { + ok(el.is(":data(test)"), msg); + } + function shouldNotHaveData(msg) { + ok(!el.is(":data(test)"), msg); + } + + el = $("
      "); + shouldNotHaveData("data never set"); + + el = $("
      ").data("test", null); + shouldNotHaveData("data is null"); + + el = $("
      ").data("test", true); + shouldHaveData("data set to true"); + + el = $("
      ").data("test", false); + shouldNotHaveData("data set to false"); + + el = $("
      ").data("test", 0); + shouldNotHaveData("data set to 0"); + + el = $("
      ").data("test", 1); + shouldHaveData("data set to 1"); + + el = $("
      ").data("test", ""); + shouldNotHaveData("data set to empty string"); + + el = $("
      ").data("test", "foo"); + shouldHaveData("data set to string"); + + el = $("
      ").data("test", []); + shouldHaveData("data set to empty array"); + + el = $("
      ").data("test", [1]); + shouldHaveData("data set to array"); + + el = $("
      ").data("test", {}); + shouldHaveData("data set to empty object"); + + el = $("
      ").data("test", {foo: "bar"}); + shouldHaveData("data set to object"); + + el = $("
      ").data("test", new Date()); + shouldHaveData("data set to date"); + + el = $("
      ").data("test", /test/); + shouldHaveData("data set to regexp"); + + el = $("
      ").data("test", function() {}); + shouldHaveData("data set to function"); +}); + +test("focusable - visible, enabled elements", function() { + expect(18); + + isNotFocusable("#formNoTabindex", "form"); + isFocusable("#formTabindex", "form with tabindex"); + isFocusable("#visibleAncestor-inputTypeNone", "input, no type"); + isFocusable("#visibleAncestor-inputTypeText", "input, type text"); + isFocusable("#visibleAncestor-inputTypeCheckbox", "input, type checkbox"); + isFocusable("#visibleAncestor-inputTypeRadio", "input, type radio"); + isFocusable("#visibleAncestor-inputTypeButton", "input, type button"); + isNotFocusable("#visibleAncestor-inputTypeHidden", "input, type hidden"); + isFocusable("#visibleAncestor-button", "button"); + isFocusable("#visibleAncestor-select", "select"); + isFocusable("#visibleAncestor-textarea", "textarea"); + isFocusable("#visibleAncestor-object", "object"); + isFocusable("#visibleAncestor-anchorWithHref", "anchor with href"); + isNotFocusable("#visibleAncestor-anchorWithoutHref", "anchor without href"); + isNotFocusable("#visibleAncestor-span", "span"); + isNotFocusable("#visibleAncestor-div", "div"); + isFocusable("#visibleAncestor-spanWithTabindex", "span with tabindex"); + isFocusable("#visibleAncestor-divWithNegativeTabindex", "div with tabindex"); +}); + +test("focusable - disabled elements", function() { + expect(9); + + isNotFocusable("#disabledElement-inputTypeNone", "input, no type"); + isNotFocusable("#disabledElement-inputTypeText", "input, type text"); + isNotFocusable("#disabledElement-inputTypeCheckbox", "input, type checkbox"); + isNotFocusable("#disabledElement-inputTypeRadio", "input, type radio"); + isNotFocusable("#disabledElement-inputTypeButton", "input, type button"); + isNotFocusable("#disabledElement-inputTypeHidden", "input, type hidden"); + isNotFocusable("#disabledElement-button", "button"); + isNotFocusable("#disabledElement-select", "select"); + isNotFocusable("#disabledElement-textarea", "textarea"); +}); + +test("focusable - hidden styles", function() { + expect(8); + + isNotFocusable("#displayNoneAncestor-input", "input, display: none parent"); + isNotFocusable("#displayNoneAncestor-span", "span with tabindex, display: none parent"); + + isNotFocusable("#visibilityHiddenAncestor-input", "input, visibility: hidden parent"); + isNotFocusable("#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent"); + + isNotFocusable("#displayNone-input", "input, display: none"); + isNotFocusable("#visibilityHidden-input", "input, visibility: hidden"); + + isNotFocusable("#displayNone-span", "span with tabindex, display: none"); + isNotFocusable("#visibilityHidden-span", "span with tabindex, visibility: hidden"); +}); + +test("focusable - natively focusable with various tabindex", function() { + expect(4); + + isFocusable("#inputTabindex0", "input, tabindex 0"); + isFocusable("#inputTabindex10", "input, tabindex 10"); + isFocusable("#inputTabindex-1", "input, tabindex -1"); + isFocusable("#inputTabindex-50", "input, tabindex -50"); +}); + +test("focusable - not natively focusable with various tabindex", function() { + expect(4); + + isFocusable("#spanTabindex0", "span, tabindex 0"); + isFocusable("#spanTabindex10", "span, tabindex 10"); + isFocusable("#spanTabindex-1", "span, tabindex -1"); + isFocusable("#spanTabindex-50", "span, tabindex -50"); +}); + +test("focusable - area elements", function() { + expect( 3 ); + + isFocusable("#areaCoordsHref", "coords and href"); + isFocusable("#areaNoCoordsHref", "href but no coords"); + isNotFocusable("#areaNoImg", "not associated with an image"); +}); + +test( "focusable - dimensionless parent with overflow", function() { + expect( 1 ); + + isFocusable( "#dimensionlessParent", "input" ); +}); + +test("tabbable - visible, enabled elements", function() { + expect(18); + + isNotTabbable("#formNoTabindex", "form"); + isTabbable("#formTabindex", "form with tabindex"); + isTabbable("#visibleAncestor-inputTypeNone", "input, no type"); + isTabbable("#visibleAncestor-inputTypeText", "input, type text"); + isTabbable("#visibleAncestor-inputTypeCheckbox", "input, type checkbox"); + isTabbable("#visibleAncestor-inputTypeRadio", "input, type radio"); + isTabbable("#visibleAncestor-inputTypeButton", "input, type button"); + isNotTabbable("#visibleAncestor-inputTypeHidden", "input, type hidden"); + isTabbable("#visibleAncestor-button", "button"); + isTabbable("#visibleAncestor-select", "select"); + isTabbable("#visibleAncestor-textarea", "textarea"); + isTabbable("#visibleAncestor-object", "object"); + isTabbable("#visibleAncestor-anchorWithHref", "anchor with href"); + isNotTabbable("#visibleAncestor-anchorWithoutHref", "anchor without href"); + isNotTabbable("#visibleAncestor-span", "span"); + isNotTabbable("#visibleAncestor-div", "div"); + isTabbable("#visibleAncestor-spanWithTabindex", "span with tabindex"); + isNotTabbable("#visibleAncestor-divWithNegativeTabindex", "div with tabindex"); +}); + +test("tabbable - disabled elements", function() { + expect(9); + + isNotTabbable("#disabledElement-inputTypeNone", "input, no type"); + isNotTabbable("#disabledElement-inputTypeText", "input, type text"); + isNotTabbable("#disabledElement-inputTypeCheckbox", "input, type checkbox"); + isNotTabbable("#disabledElement-inputTypeRadio", "input, type radio"); + isNotTabbable("#disabledElement-inputTypeButton", "input, type button"); + isNotTabbable("#disabledElement-inputTypeHidden", "input, type hidden"); + isNotTabbable("#disabledElement-button", "button"); + isNotTabbable("#disabledElement-select", "select"); + isNotTabbable("#disabledElement-textarea", "textarea"); +}); + +test("tabbable - hidden styles", function() { + expect(8); + + isNotTabbable("#displayNoneAncestor-input", "input, display: none parent"); + isNotTabbable("#displayNoneAncestor-span", "span with tabindex, display: none parent"); + + isNotTabbable("#visibilityHiddenAncestor-input", "input, visibility: hidden parent"); + isNotTabbable("#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent"); + + isNotTabbable("#displayNone-input", "input, display: none"); + isNotTabbable("#visibilityHidden-input", "input, visibility: hidden"); + + isNotTabbable("#displayNone-span", "span with tabindex, display: none"); + isNotTabbable("#visibilityHidden-span", "span with tabindex, visibility: hidden"); +}); + +test("tabbable - natively tabbable with various tabindex", function() { + expect(4); + + isTabbable("#inputTabindex0", "input, tabindex 0"); + isTabbable("#inputTabindex10", "input, tabindex 10"); + isNotTabbable("#inputTabindex-1", "input, tabindex -1"); + isNotTabbable("#inputTabindex-50", "input, tabindex -50"); +}); + +test("tabbable - not natively tabbable with various tabindex", function() { + expect(4); + + isTabbable("#spanTabindex0", "span, tabindex 0"); + isTabbable("#spanTabindex10", "span, tabindex 10"); + isNotTabbable("#spanTabindex-1", "span, tabindex -1"); + isNotTabbable("#spanTabindex-50", "span, tabindex -50"); +}); + +test("tabbable - area elements", function() { + expect( 3 ); + + isTabbable("#areaCoordsHref", "coords and href"); + isTabbable("#areaNoCoordsHref", "href but no coords"); + isNotTabbable("#areaNoImg", "not associated with an image"); +}); + +test( "tabbable - dimensionless parent with overflow", function() { + expect( 1 ); + + isTabbable( "#dimensionlessParent", "input" ); +}); + +})(jQuery); -- cgit v1.2.2