From fdedf1616d03b07c84045a3fd57d3cff073c6148 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 4 Apr 2011 10:11:19 -0400 Subject: [PATCH] Tabs: Test cleanup. --- tests/unit/tabs/tabs.html | 193 +++++++++++++------------- tests/unit/tabs/tabs_core.js | 49 ++++--- tests/unit/tabs/tabs_deprecated.html | 196 ++++++++++++++------------- 3 files changed, 227 insertions(+), 211 deletions(-) diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index 02fbfe3bb..36e30517e 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -1,33 +1,32 @@ - + - + jQuery UI Tabs Test Suite - + - + - - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + - + @@ -45,80 +44,86 @@

-
    -
- +
    -
    -
      -
    • 1
    • -
    • 2
    • -
    • 3
    • -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
      -
    • 1
    • -
    -
    -
    -
    -
      -
    • 1
    • -
    -
      -
    1. 1
    2. -
    -
    -
    -
      -
    1. 1
    2. -
    +
    +
      +
    • 1
    • +
    • 2
    • +
    • 3
    • +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    +
      +
    • 1
    • +
    +
    +
    + +
    +
      +
    • 1
    • +
    +
      +
    1. 1
    2. +
    +
    + +
    +
      +
    1. 1
    2. +
    +
      +
    • 1
    • +
    +
    + +
    +
    +
      +
      +
      + +
      +
      -
      -
      -
        -
        -
        -
        -
          -
        • 1 -
            -
          • 3
          • -
          • 4
          • -
          -
        • -
        • 2
        • -
        -
        -
        -
        -
        -
          -
        • 1
        • -
        • 2
        • -
        -
        -
        -
        -
        + +
      • 2
      • + +
        +
        +
        + +
        + +
        +
        +
        + + diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js index 7d9074819..25e54c3ee 100644 --- a/tests/unit/tabs/tabs_core.js +++ b/tests/unit/tabs/tabs_core.js @@ -1,28 +1,33 @@ -/* - * tabs_core.js - */ -var el; +(function( $ ) { -(function($) { +module( "tabs: core" ); -module("tabs: core"); - -test('navigation markup', function() { - el = $('#tabs3').tabs(); - ok($('#tabs3-list').hasClass('ui-tabs-nav'), 'custom markup; allow list to be any descendant'); - el.tabs('destroy'); - - el = $('#tabs4').tabs(); - ok($('#tabs4-list').hasClass('ui-tabs-nav'), 'first list found becomes nav - ul'); - el.tabs('destroy'); +test( "markup structure", function() { + expect( 3 ); + var el = $( "#tabs1" ).tabs(); + ok( el.hasClass( "ui-tabs" ), "main element is .ui-tabs" ); + ok( el.find( "ul" ).hasClass( "ui-tabs-nav" ), "list item is .ui-tabs-nav" ); + equal( el.find( ".ui-tabs-panel" ).length, 3, + ".ui-tabs-panel elements exist, correct number" ); +}); - el = $('#tabs4a').tabs(); - ok($('#tabs4a-list').hasClass('ui-tabs-nav'), 'first list found becomes nav - ol'); - el.tabs('destroy'); +$.each({ + "deep ul": "#tabs3", + "multiple lists, ul first": "#tabs4", + "multiple lists, ol first": "#tabs5", + "empty list": "#tabs6" +}, function( type, selector ) { + test( "markup structure: " + type, function() { + expect( 2 ); + var el = $( selector ).tabs(); + ok( el.hasClass( "ui-tabs" ), "main element is .ui-tabs" ); + ok( $( selector + "-list" ).hasClass( "ui-tabs-nav" ), + "list item is .ui-tabs-nav" ); + }); +}); - el = $('#tabs5').tabs(); - ok($('#tabs5-list').hasClass('ui-tabs-nav'), 'empty list can be used'); - el.tabs('destroy'); +test( "accessibility", function() { + // TODO: add tests }); -})(jQuery); +}( jQuery ) ); diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html index 3b927675c..f886a9b7b 100644 --- a/tests/unit/tabs/tabs_deprecated.html +++ b/tests/unit/tabs/tabs_deprecated.html @@ -1,31 +1,31 @@ - + - + jQuery UI Tabs Test Suite - + - - - - - + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + - + -

        jQuery UI Tabs Test Suite (deprecated)

        +

        jQuery UI Tabs Test Suite

        -
          -
        - +
          -
          -
            -
          • 1
          • -
          • 2
          • -
          • 3
          • -
          -
          -
          -
          -
          -
          - -
          -
          -
          -
          -
          -
            -
          • 1
          • -
          -
          -
          -
          -
            -
          • 1
          • -
          -
            -
          1. 1
          2. -
          -
          -
          -
            -
          1. 1
          2. -
          +
          +
            +
          • 1
          • +
          • 2
          • +
          • 3
          • +
          +
          +
          +
          +
          + +
          + +
          +
          +
          + +
          +
          +
            +
          • 1
          • +
          +
          +
          + +
          +
            +
          • 1
          • +
          +
            +
          1. 1
          2. +
          +
          + +
          +
            +
          1. 1
          2. +
          +
            +
          • 1
          • +
          +
          + +
          +
          +
            +
            +
            + +
            +
            -
            -
            -
              -
              -
              -
              -
                -
              • 1 -
                  -
                • 3
                • -
                • 4
                • -
                -
              • -
              • 2
              • -
              -
              -
              -
              -
              -
                -
              • 1
              • -
              • 2
              • -
              -
              -
              -
              -
              + +
            • 2
            • + +
              +
              +
              + +
              + +
              +
              +
              + + -- 2.39.5