From 32a00607f1c74b5ee12db005e7524ec1783bb2ac Mon Sep 17 00:00:00 2001 From: Eric Dahl Date: Mon, 18 Nov 2013 16:45:12 -0600 Subject: [PATCH 01/10] Demos: Fix small typos --- demos/spinner/latlong.html | 2 +- demos/tabs/manipulation.html | 2 +- demos/tooltip/video-player.html | 2 +- demos/widget/default.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/demos/spinner/latlong.html b/demos/spinner/latlong.html index 56338205c..1c419ad6b 100644 --- a/demos/spinner/latlong.html +++ b/demos/spinner/latlong.html @@ -51,7 +51,7 @@
-

Google Maps integration, using spinners to change latidude and longitude.

+

Google Maps integration, using spinners to change latitude and longitude.

diff --git a/demos/tabs/manipulation.html b/demos/tabs/manipulation.html index 61a59271b..62239c4b7 100644 --- a/demos/tabs/manipulation.html +++ b/demos/tabs/manipulation.html @@ -29,7 +29,7 @@ var tabs = $( "#tabs" ).tabs(); - // modal dialog init: custom buttons and a "close" callback reseting the form inside + // modal dialog init: custom buttons and a "close" callback resetting the form inside var dialog = $( "#dialog" ).dialog({ autoOpen: false, modal: true, diff --git a/demos/tooltip/video-player.html b/demos/tooltip/video-player.html index f95e2de66..3a4bc777f 100644 --- a/demos/tooltip/video-player.html +++ b/demos/tooltip/video-player.html @@ -107,7 +107,7 @@ - +
diff --git a/demos/widget/default.html b/demos/widget/default.html index 444de83b6..0ffc67138 100644 --- a/demos/widget/default.html +++ b/demos/widget/default.html @@ -149,7 +149,7 @@ } }); - // click to set options after initalization + // click to set options after initialization $( "#black" ).click( function() { $( ":custom-colorize" ).colorize( "option", { red: 0, From 1096f19f37d6075328509d62a4c2c6d6a53d4b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rn=20Zaefferer?= Date: Sat, 16 Nov 2013 12:21:02 +0100 Subject: [PATCH 02/10] Dialog: Keep track of instances to focus when elements outside the dialog get focus. Works with inheritance. Adds tests for both. Fixes #9241 - Dialog: UI dialog inheritance causes undefined property '_focusTabbable' in IE9 --- tests/unit/dialog/dialog_core.js | 48 ++++++++++++++++++++++++++++++++ ui/jquery.ui.dialog.js | 23 +++++++++++++-- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js index 062d44576..c08019da9 100644 --- a/tests/unit/dialog/dialog_core.js +++ b/tests/unit/dialog/dialog_core.js @@ -4,6 +4,7 @@ (function($) { +// TODO add teardown callback to remove dialogs module("dialog: core"); test("title id", function() { @@ -180,4 +181,51 @@ asyncTest( "#9048: multiple modal dialogs opened and closed in different order", start(); }); }); + +asyncTest( "interaction between overlay and other dialogs", function() { + $.widget( "ui.testWidget", $.ui.dialog, { + options: { + modal: true, + autoOpen: false + } + }); + expect( 2 ); + var first = $( "
" ).dialog({ + modal: true + }), + firstInput = first.find( "input" ), + second = $( "
" ).testWidget(), + secondInput = second.find( "input" ); + + // Support: IE8 + // For some reason the focus doesn't get set properly if we don't + // focus the body first. + $( "body" ).focus(); + + // Wait for the modal to init + setTimeout(function() { + second.testWidget( "open" ); + + // Simulate user tabbing from address bar to an element outside the dialog + $( "#favorite-animal" ).focus(); + setTimeout(function() { + equal( document.activeElement, secondInput[ 0 ] ); + + // Last active dialog must receive focus + firstInput.focus(); + $( "#favorite-animal" ).focus(); + setTimeout(function() { + equal( document.activeElement, firstInput[ 0 ] ); + + // Cleanup + first.remove(); + second.remove(); + delete $.ui.testWidget; + delete $.fn.testWidget; + start(); + }); + }); + }); +}); + })(jQuery); diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index d3ce333f4..7f90908bd 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -182,6 +182,7 @@ $.widget( "ui.dialog", { this._isOpen = false; this._focusedElement = null; this._destroyOverlay(); + this._untrackInstance(); if ( !this.opener.filter( ":focusable" ).focus().length ) { @@ -562,11 +563,30 @@ $.widget( "ui.dialog", { _trackFocus: function() { this._on( this.widget(), { "focusin": function( event ) { + this._untrackInstance(); + this._trackingInstances().unshift( this ); this._focusedElement = $( event.target ); } }); }, + _untrackInstance: function() { + var instances = this._trackingInstances(), + exists = $.inArray( this, instances ); + if ( exists !== -1 ) { + instances.splice( exists, 1 ); + } + }, + + _trackingInstances: function() { + var instances = this.document.data( "ui-dialog-instances" ); + if ( !instances ) { + instances = []; + this.document.data( "ui-dialog-instances", instances ); + } + return instances; + }, + _minHeight: function() { var options = this.options; @@ -783,8 +803,7 @@ $.widget( "ui.dialog", { if ( !this._allowInteraction( event ) ) { event.preventDefault(); - this.document.find( ".ui-dialog:visible:last .ui-dialog-content" ) - .data( this.widgetFullName )._focusTabbable(); + this._trackingInstances()[ 0 ]._focusTabbable(); } } }); From 6a74bf992944419caabc7adb8ec8ca758451f1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 20 Nov 2013 11:14:19 -0500 Subject: [PATCH 03/10] Menu tests: Force line height to ensure we know how many items will be scrolled. --- tests/unit/menu/menu.html | 4 ++++ tests/unit/menu/menu_events.js | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/unit/menu/menu.html b/tests/unit/menu/menu.html index a49c72a04..504d3f3cf 100644 --- a/tests/unit/menu/menu.html +++ b/tests/unit/menu/menu.html @@ -31,6 +31,10 @@ - - + }); - -
- -

Accordion

-
-
-
-

First

-
Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.
-
-
-

Second

-
Phasellus mattis tincidunt nibh.
-
-
-

Third

-
Nam dui erat, auctor a, dignissim quis.
-
-
+ // Progressbar + $("#progressbar").progressbar({ + value: 20 + }); + + //hover states on the static widgets + $('#dialog_link, ul#icons li').hover( + function() { $(this).addClass('ui-state-hover'); }, + function() { $(this).removeClass('ui-state-hover'); } + ); + + $(".buttonset > button").button() + .next() + .button({ + text: false, + icons: { + primary: "ui-icon-triangle-1-s" + } + }) + .parent() + .buttonset(); + + + $('#beginning').button({ + text: false, + icons: { + primary: 'ui-icon-seek-start' + } + }); + $('#rewind').button({ + text: false, + icons: { + primary: 'ui-icon-seek-prev' + } + }); + $('#play').button({ + text: false, + icons: { + primary: 'ui-icon-play' + } + }); + $('#stop').button({ + text: false, + icons: { + primary: 'ui-icon-stop' + } + }); + $('#forward').button({ + text: false, + icons: { + primary: 'ui-icon-seek-next' + } + }); + $('#end').button({ + text: false, + icons: { + primary: 'ui-icon-seek-end' + } + }); + $("#shuffle").button(); + $("#repeat").buttonset(); + + }); + + + + + +
+ + +

Accordion

+
+
+
+

First

+
Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.
-
-
-
-

First no icons

-
Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.
-
-
-

Second no icons

-
Phasellus mattis tincidunt nibh.
-
-
-

Third no icons

-
Nam dui erat, auctor a, dignissim quis.
-
-
+
+

Second

+
Phasellus mattis tincidunt nibh.
- - - -

Tabs

-
- -
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
-
Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.
-
Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.
+
+

Third

+
Nam dui erat, auctor a, dignissim quis.
- - -

Dialog

-

Open Dialog

- -
Inline Dialogclose
-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

-
- - -

Overlay and Shadow Classes (not currently used in UI widgets)

-
-

Lorem ipsum dolor sit amet, Nulla nec tortor. Donec id elit quis purus consectetur consequat.

Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci.

Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat.

Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam.

Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante.

Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi.

- - -
-
-
-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

-
-
- +
+
+
+
+
+

First no icons

+
Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.
+
+

Second no icons

+
Phasellus mattis tincidunt nibh.
+
+
+

Third no icons

+
Nam dui erat, auctor a, dignissim quis.
+
+
+
- -
+ +

Tabs

+
+ +
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+
Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.
+
Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.
+
+ + +

Dialog

+

Open Dialog

+ +
Inline Dialogclose
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

+
+ + +

Overlay and Shadow Classes (not currently used in UI widgets)

+
+

Lorem ipsum dolor sit amet, Nulla nec tortor. Donec id elit quis purus consectetur consequat.

Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci.

Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat.

Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam.

Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante.

Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi.

+ + +
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

+
+ +
+ + + +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

+
-

Framework Icons (content color preview)

-
    +

    Framework Icons (content color preview)

    +
      -
    • -
    • -
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • -
    • -
    • -
    • -
    • -
    • -
    +
  • +
  • +
  • +
  • +
  • +
- -

Slider

-
-
-
-
-
- 88 - 77 - 55 - 33 - 40 - 45 - 70 -
-
+ +

Slider

+
+
+
+
+
+ 88 + 77 + 55 + 33 + 40 + 45 + 70 +
+
- -

Datepicker

-
-
-
-
-
-
+ +

Datepicker

+
+
+
+
+
+
- -

Progressbar

-
+ +

Progressbar

+
- -

Highlight / Error

-
-
-

- Hey! Sample ui-state-highlight style.

-
-
-
-
-
-

- Alert: Sample ui-state-error style.

-
-
+ +

Highlight / Error

+
+
+

+ Hey! Sample ui-state-highlight style.

+
+
+
+
+
+

+ Alert: Sample ui-state-error style.

+
+
-

Button

+

Button

-
- - -
+
+ + +
- - - - - - - + + + + + + + - + - - - - - - + + + + + + - + - - + + - - - + - - From b12cf01317cd29bd1140e47d31e85d96749da894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rn=20Zaefferer?= Date: Wed, 20 Nov 2013 20:03:35 +0100 Subject: [PATCH 05/10] Demos: There can be only one button.js --- demos/dialog/modal-confirmation.html | 1 - 1 file changed, 1 deletion(-) diff --git a/demos/dialog/modal-confirmation.html b/demos/dialog/modal-confirmation.html index 7b6d4835d..4bcc234da 100644 --- a/demos/dialog/modal-confirmation.html +++ b/demos/dialog/modal-confirmation.html @@ -11,7 +11,6 @@ - From 161d7ee38905ea2ce425bca3baa499fada41c98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 22 Nov 2013 10:49:44 -0500 Subject: [PATCH 09/10] Tests: Updated URL for TestSwarm. --- tests/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/index.html b/tests/index.html index 38595f0b0..53487e8b3 100644 --- a/tests/index.html +++ b/tests/index.html @@ -18,7 +18,7 @@

Unit tests exist for all functionality in jQuery UI. The unit tests can be run locally (some tests require a web server with PHP) to ensure proper functionality before committing changes. - The unit tests are also run on TestSwarm + The unit tests are also run on TestSwarm for every commit.

Visual Tests

From 8eeb0e7d88a943e3860f8492661ac8090cb8d3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 22 Nov 2013 11:43:55 -0500 Subject: [PATCH 10/10] Tests: Skip JSHint in browsers that don't support Function.prototype.bind() to work around a bug in JSHint. --- tests/unit/testsuite.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index 13daa7e66..ffd1e73de 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -59,7 +59,9 @@ QUnit.config.urlConfig.push({ jshintLoaded = false; TestHelpers.testJshint = function( module ) { - if ( QUnit.urlParams.nojshint ) { + // Function.prototype.bind check is needed because JSHint doesn't work in ES3 browsers anymore + // https://github.com/jshint/jshint/issues/1384 + if ( QUnit.urlParams.nojshint || !Function.prototype.bind ) { return; }