]> source.dussan.org Git - jquery-ui.git/commitdiff
Calendar tests: Adjust structure tests to latest changes
authorFelix Nagel <info@felixnagel.com>
Thu, 3 Dec 2015 10:57:35 +0000 (11:57 +0100)
committerFelix Nagel <info@felixnagel.com>
Thu, 10 Dec 2015 11:07:50 +0000 (12:07 +0100)
tests/unit/calendar/core.js
tests/unit/datepicker/core.js

index b9c5836a17df10ea9d449371bb6aecf783b44bd8..65daf1bd4581ed06ef6ef205043b6af7e55e6933 100644 (file)
@@ -7,22 +7,26 @@ define( [
 module( "calendar: core" );
 
 test( "base structure", function() {
-       expect( 26 );
+       expect( 28 );
 
-       var header, title, table, thead, week, child, buttonpane,
+       var buttons, header, title, table, thead, week, child, buttonpane,
                element = $( "#calendar" ).calendar(),
                dp = element.calendar( "widget" );
 
        function step1() {
                ok( !dp.is( ".ui-calendar-rtl" ), "Structure - not right-to-left" );
                ok( !dp.is( ".ui-calendar-multi" ), "Structure - not multi-month" );
-               equal( dp.children().length, 2, "Structure - child count (header, calendar)" );
+               equal( dp.children().length, 3, "Structure - child count (header, calendar)" );
 
-               header = dp.children( ":first" );
+               buttons = dp.children( ":first" );
+               ok( buttons.is( "div.ui-calendar-header-buttons" ), "Structure - header button division" );
+               equal( buttons.children().length, 2, "Structure - header buttons child count" );
+               ok( buttons.children( ":first" ).is( ".ui-calendar-prev" ) && buttons.children( ":first" ).html() !== "", "Structure - prev link" );
+               ok( buttons.children( ":last" ).is( ".ui-calendar-next" ) && buttons.children( ":last" ).html() !== "", "Structure - next link" );
+
+               header = dp.children( ":eq(1)" );
                ok( header.is( "div.ui-calendar-header" ), "Structure - header division" );
-               equal( header.children().length, 3, "Structure - header child count" );
-               ok( header.children( ":first" ).is( ".ui-calendar-prev" ) && header.children( ":first" ).html() !== "", "Structure - prev link" );
-               ok( header.children( ":eq(1)" ).is( ".ui-calendar-next" ) && header.children( ":eq(1)" ).html() !== "", "Structure - next link" );
+               equal( header.children().length, 1, "Structure - header child count" );
 
                title = header.children( ":last" ).children( ":first" );
                ok( title.is( "div.ui-calendar-title" ) && title.html() !== "", "Structure - title division" );
@@ -30,7 +34,7 @@ test( "base structure", function() {
                ok( title.children( ":first" ).is( "span.ui-calendar-month" ) && title.children( ":first" ).text() !== "", "Structure - month text" );
                ok( title.children( ":last" ).is( "span.ui-calendar-year" ) && title.children( ":last" ).text() !== "", "Structure - year text" );
 
-               table = dp.children( ":eq(1)" );
+               table = dp.children( ":eq(2)" );
                ok( table.is( "table.ui-calendar-calendar" ), "Structure - month table" );
                ok( table.children( ":first" ).is( "thead" ), "Structure - month table thead" );
 
@@ -53,7 +57,7 @@ test( "base structure", function() {
                        "test button": function() {}
                } );
 
-               equal( dp.children().length, 3, "Structure buttons - child count (header, calendar, buttonpane)" );
+               equal( dp.children().length, 4, "Structure buttons - child count (header buttons, header, calendar, buttonpane)" );
 
                buttonpane = dp.children( ".ui-calendar-buttonpane" );
                equal( buttonpane.children( "div.ui-calendar-buttonset" ).length, 1, "Structure buttons - buttonset" );
@@ -71,9 +75,9 @@ test( "base structure", function() {
                dp = element.calendar( "widget" );
 
                ok( dp.is( ".ui-calendar-multi" ), "Structure multi [2] - multi-month" );
-               equal( dp.children().length, 3, "Structure multi [2] - child count" );
+               equal( dp.children().length, 4, "Structure multi [2] - child count" );
 
-               child = dp.children( ":eq(2)" );
+               child = dp.children( ":eq(3)" );
                ok( child.is( "div.ui-calendar-row-break" ), "Structure multi [2] - row break" );
 
                element.calendar( "destroy" );
index 83882ef7aeedc22b49c07bc1f0138f8595b6f874..cfcc9c947069a129403a709be91a0ff4f98d3d7a 100644 (file)
@@ -31,7 +31,7 @@ asyncTest( "base structure", function() {
 
        setTimeout( function() {
                ok( widget.is( ":visible" ), "Datepicker visible" );
-               equal( widget.children().length, 2, "Child count" );
+               equal( widget.children().length, 3, "Child count" );
                ok( widget.is( ".ui-calendar" ), "Class ui-calendar" );
                ok( widget.is( ".ui-datepicker" ), "Class ui-datepicker" );
                ok( widget.is( ".ui-front" ), "Class ui-front" );