corrade-http-templates – Blame information for rev 57
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
57 | office | 1 | define( [ |
2 | "qunit", |
||
3 | "jquery", |
||
4 | "ui/widgets/dialog" |
||
5 | ], function( QUnit, $ ) { |
||
6 | |||
7 | QUnit.module( "dialog (deprecated): options" ); |
||
8 | |||
9 | QUnit.test( "dialogClass", function( assert ) { |
||
10 | assert.expect( 5 ); |
||
11 | |||
12 | var element = $( "<div>" ).dialog(), |
||
13 | widget = element.dialog( "widget" ); |
||
14 | assert.lacksClasses( widget, "foo", "dialogClass not specified. class not added" ); |
||
15 | element.remove(); |
||
16 | |||
17 | element = $( "<div>" ).dialog( { dialogClass: "foo" } ); |
||
18 | widget = element.dialog( "widget" ); |
||
19 | assert.hasClasses( widget, "foo", "dialogClass in init, foo class added" ); |
||
20 | element.dialog( "option", "dialogClass", "foobar" ); |
||
21 | assert.lacksClasses( widget, "foo", "dialogClass changed, previous one was removed" ); |
||
22 | assert.hasClasses( widget, "foobar", "dialogClass changed, new one was added" ); |
||
23 | element.remove(); |
||
24 | |||
25 | element = $( "<div>" ).dialog( { dialogClass: "foo bar" } ); |
||
26 | widget = element.dialog( "widget" ); |
||
27 | assert.hasClasses( widget, "foo bar", "dialogClass in init, two classes." ); |
||
28 | element.remove(); |
||
29 | } ); |
||
30 | |||
31 | QUnit.test( "buttons - deprecated options", function( assert ) { |
||
32 | assert.expect( 7 ); |
||
33 | |||
34 | var buttons, |
||
35 | element = $( "<div></div>" ).dialog( { |
||
36 | buttons: [ |
||
37 | { |
||
38 | html: "a button", |
||
39 | "class": "additional-class", |
||
40 | id: "my-button-id", |
||
41 | click: function() { |
||
42 | assert.equal( this, element[ 0 ], "correct context" ); |
||
43 | }, |
||
44 | icons: { primary: "ui-icon-cancel" }, |
||
45 | text: false |
||
46 | } |
||
47 | ] |
||
48 | } ); |
||
49 | |||
50 | buttons = element.dialog( "widget" ).find( ".ui-dialog-buttonpane button" ); |
||
51 | assert.equal( buttons.length, 1, "correct number of buttons" ); |
||
52 | assert.equal( buttons.attr( "id" ), "my-button-id", "correct id" ); |
||
53 | assert.equal( $.trim( buttons.text() ), "a button", "correct label" ); |
||
54 | assert.hasClasses( buttons, "additional-class" ); |
||
55 | assert.deepEqual( buttons.button( "option", "icon" ), "ui-icon-cancel" ); |
||
56 | assert.equal( buttons.button( "option", "showLabel" ), false ); |
||
57 | buttons.trigger( "click" ); |
||
58 | |||
59 | element.remove(); |
||
60 | } ); |
||
61 | } ); |