-
Notifications
You must be signed in to change notification settings - Fork 5.2k
All: Classes Option #1369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All: Classes Option #1369
Changes from 1 commit
891a7d9
6a6446b
07f52c1
f8c5aea
544f9ff
3c52f19
b1c0f22
43ec02b
51d1d33
0aa2e1f
9562d7a
808bb7f
a813056
330dc7e
157ba04
8c0b1ac
dfaba1d
af57abd
aa4bbb3
e59c360
d93e475
31dcc86
2a0b8eb
69bdbfc
b238f36
c31c9f1
9ab23dc
c5ada6d
98a2cc7
7c7acda
836feb5
b97ff0e
5dd9120
e183631
7628f28
cecd4e2
328308a
758ff6c
21fbfa3
7382fd3
3ac52a8
ab96209
0fec7d4
ef9ed64
913edd3
a0b707b
7a3eaa8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Deprecate dialogClass. Fixes #7053
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| TestHelpers.commonWidgetTests( "dialog", { | ||
| defaults: { | ||
| appendTo: "body", | ||
| autoOpen: true, | ||
| buttons: [], | ||
| classes: { | ||
| "ui-dialog": "ui-corner-all", | ||
| "ui-dialog-content": null, | ||
| "ui-dialog-titlebar": "ui-corner-all", | ||
| "ui-dialog-titlebar-close": null, | ||
| "ui-dialog-title": null, | ||
| "ui-dialog-buttons": null, | ||
| "ui-dialog-buttonpane": null, | ||
| "ui-dialog-buttonset": null, | ||
| "ui-dialog-dragging": null, | ||
| "ui-dialog-resizing": null, | ||
| "ui-widget-overlay": null | ||
| }, | ||
| closeOnEscape: true, | ||
| closeText: "close", | ||
| dialogClass: "", | ||
| disabled: false, | ||
| draggable: true, | ||
| height: "auto", | ||
| hide: null, | ||
| maxHeight: null, | ||
| maxWidth: null, | ||
| minHeight: 150, | ||
| minWidth: 150, | ||
| modal: false, | ||
| position: { | ||
| my: "center", | ||
| at: "center", | ||
| of: window, | ||
| collision: "fit", | ||
| using: $.ui.dialog.prototype.options.position.using | ||
| }, | ||
| resizable: true, | ||
| show: null, | ||
| title: null, | ||
| width: 300, | ||
|
|
||
| // callbacks | ||
| beforeClose: null, | ||
| close: null, | ||
| create: null, | ||
| drag: null, | ||
| dragStart: null, | ||
| dragStop: null, | ||
| focus: null, | ||
| open: null, | ||
| resize: null, | ||
| resizeStart: null, | ||
| resizeStop: null | ||
| } | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>jQuery UI Dialog Test Suite</title> | ||
|
|
||
| <script src="../../jquery.js"></script> | ||
| <script> | ||
| $.uiBackCompat = true; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be dropped (also for tooltip and where ever else its used). The check in In other words, an undefined May need to do the same update in the button branch. |
||
| </script> | ||
| <link rel="stylesheet" href="../../../external/qunit/qunit.css"> | ||
| <script src="../../../external/qunit/qunit.js"></script> | ||
| <script src="../../../external/jquery-simulate/jquery.simulate.js"></script> | ||
| <script src="../testsuite.js"></script> | ||
| <script> | ||
| TestHelpers.loadResources({ | ||
| css: [ "core", "dialog" ], | ||
| js: [ | ||
| "ui/core.js", | ||
| "ui/widget.js", | ||
| "ui/position.js", | ||
| "ui/mouse.js", | ||
| "ui/draggable.js", | ||
| "ui/resizable.js", | ||
| "ui/button.js", | ||
| "ui/effect.js", | ||
| "ui/effect-blind.js", | ||
| "ui/effect-clip.js", | ||
| "ui/effect-explode.js", | ||
| "ui/dialog.js" | ||
| ] | ||
| }); | ||
| </script> | ||
|
|
||
| <script src="dialog_common_derecated.js"></script> | ||
| <script src="dialog_core.js"></script> | ||
| <script src="dialog_events.js"></script> | ||
| <script src="dialog_methods.js"></script> | ||
| <script src="dialog_options.js"></script> | ||
| <script src="dialog_deprecated.js"></script> | ||
| <script src="dialog_test_helpers.js"></script> | ||
|
|
||
| <script src="../swarminject.js"></script> | ||
| </head> | ||
| <body> | ||
|
|
||
| <div id="qunit"></div> | ||
| <div id="qunit-fixture"> | ||
| <div id="dialog1"></div> | ||
| <div id="dialog2"></div> | ||
| <div id="form-dialog" title="Profile Information"> | ||
| <!-- create a spacer to ensure there's enough space to scroll --> | ||
| <div style="height: 250px;">...</div> | ||
| <fieldset> | ||
| <legend>Please share some personal information</legend> | ||
| <label for="favorite-animal">Your favorite animal</label><input id="favorite-animal"> | ||
| <label for="favorite-color">Your favorite color</label><input id="favorite-color"> | ||
| </fieldset> | ||
| <div role="group" aria-describedby="section2"> | ||
| <p id="section2">Some more (optional) information</p> | ||
| <label for="favorite-food">Favorite food</label><input id="favorite-food"> | ||
| </div> | ||
| </div> | ||
| <div class="wrap" id="wrap1"></div> | ||
| <div class="wrap" id="wrap2"></div> | ||
| </div> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * dialog_deprecated.js | ||
| */ | ||
| (function( $ ) { | ||
|
|
||
| module( "dialog (deprecated): options" ); | ||
|
|
||
| test( "dialogClass", function() { | ||
| expect( 6 ); | ||
|
|
||
| var element = $( "<div></div>" ).dialog(), | ||
| widget = element.dialog( "widget" ); | ||
| equal( widget.is( ".foo" ), false, "dialogClass not specified. class not added" ); | ||
| element.remove(); | ||
|
|
||
| element = $( "<div></div>" ).dialog({ dialogClass: "foo" }); | ||
| widget = element.dialog( "widget" ); | ||
| equal( widget.is( ".foo" ), true, "dialogClass in init. foo class added"); | ||
| element.dialog( "option", "dialogClass", "foobar" ); | ||
| equal( widget.is( ".foo" ), false, "dialogClass changed, previous one was removed" ); | ||
| equal( widget.is( ".foobar" ), true, "dialogClass changed, new one was added" ); | ||
| element.remove(); | ||
|
|
||
| element = $( "<div></div>" ).dialog({ dialogClass: "foo bar" }); | ||
| widget = element.dialog( "widget" ); | ||
| equal( widget.is( ".foo" ), true, "dialogClass in init, two classes. foo class added" ); | ||
| equal( widget.is( ".bar" ), true, "dialogClass in init, two classes. bar class added" ); | ||
| element.remove(); | ||
| }); | ||
|
|
||
| })( jQuery ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ test("init", function() { | |
| }); | ||
|
|
||
| test("destroy", function() { | ||
| expect( 17 ); | ||
| expect( 18 ); | ||
|
|
||
| var element, element2; | ||
|
|
||
|
|
@@ -49,6 +49,14 @@ test("destroy", function() { | |
| equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] ); | ||
| equal( dialog.index(), 2 ); | ||
| }); | ||
| domEqual( "#dialog2", function() { | ||
| $( "#dialog2" ).dialog({ | ||
| buttons: [{ | ||
| text: "Ok", | ||
| click: $.noop | ||
| }] | ||
| }).dialog( "destroy" ); | ||
| }, "Buttons"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this assertion accomplish? Also missing space after the string.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe @petersendidit can answer this i'm not sure and he added it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At one point I was on a quest to write tests to make sure that all widgets correctly cleaned up after themselves when they were destroyed. There were a few widgets that didn't correctly remove all of their classes. Can't remember if dialog was one of them or not.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the other two assertions don't set the buttons option and that adds more markup, keeping this addition is fine. |
||
|
|
||
| // Ensure dimensions are restored (#8119) | ||
| $( "#dialog1" ).show().css({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these be replaced with a single
.attr( "class" )call inside anequal? Also applies to the groups below.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that would simplify this a lot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.attr( "class" )is bad since order doesn't matter. But.is( ".a.b.c" )will work fine.