From 767d1730403ff2d184717b43042d3ba98b71596c Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Sun, 11 Dec 2016 23:30:25 +0100 Subject: Calendar: Introduce refresh callback event --- tests/unit/calendar/common.js | 1 + tests/unit/calendar/events.js | 22 ++++++++++++++++++++++ tests/unit/datepicker/common.js | 1 + tests/unit/datepicker/events.js | 18 ++++++++++++++++++ 4 files changed, 42 insertions(+) (limited to 'tests/unit') diff --git a/tests/unit/calendar/common.js b/tests/unit/calendar/common.js index ea637a9b8..1f3a0fe21 100644 --- a/tests/unit/calendar/common.js +++ b/tests/unit/calendar/common.js @@ -37,6 +37,7 @@ common.testWidget( "calendar", { // callbacks change: null, create: null, + refresh: null, select: null } } ); diff --git a/tests/unit/calendar/events.js b/tests/unit/calendar/events.js index 6dc2e5eef..7148ff343 100644 --- a/tests/unit/calendar/events.js +++ b/tests/unit/calendar/events.js @@ -98,4 +98,26 @@ QUnit.test( "select", function( assert ) { step1(); } ); +QUnit.test( "refresh", function( assert ) { + assert.expect( 2 ); + + var shouldFire; + + this.element.calendar( { + refresh: function() { + assert.ok( shouldFire, "refresh event fired" ); + } + } ); + + shouldFire = true; + this.element.find( "button.ui-calendar-next" ).simulate( "click" ); + + shouldFire = false; + this.element.find( "table button:eq(1)" ).simulate( "click" ); + + testHelper.focusGrid( this.element ).simulate( "keydown", { keyCode: $.ui.keyCode.END } ); + shouldFire = true; + testHelper.focusGrid( this.element ).simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); +} ); + } ); diff --git a/tests/unit/datepicker/common.js b/tests/unit/datepicker/common.js index 527ddcbf3..6b0b0487d 100644 --- a/tests/unit/datepicker/common.js +++ b/tests/unit/datepicker/common.js @@ -46,6 +46,7 @@ common.testWidget( "datepicker", { close: null, create: null, open: null, + refresh: null, select: null } } ); diff --git a/tests/unit/datepicker/events.js b/tests/unit/datepicker/events.js index 76615084c..5a923d252 100644 --- a/tests/unit/datepicker/events.js +++ b/tests/unit/datepicker/events.js @@ -180,4 +180,22 @@ QUnit.test( "select", function( assert ) { step1(); } ); +QUnit.test( "refresh", function( assert ) { + assert.expect( 1 ); + + var shouldFire; + + this.element.calendar( { + refresh: function() { + assert.ok( shouldFire, "refresh event fired" ); + } + } ); + + shouldFire = true; + this.element.find( "button.ui-calendar-next" ).simulate( "click" ); + + shouldFire = false; + this.element.find( "table button:eq(1)" ).simulate( "click" ); +} ); + } ); -- cgit v1.2.3