2009-02-02 14:36:08 +00:00
|
|
|
/*
|
|
|
|
* dialog_core.js
|
|
|
|
*/
|
2009-02-04 04:35:18 +00:00
|
|
|
|
2009-02-02 14:36:08 +00:00
|
|
|
(function($) {
|
|
|
|
|
|
|
|
module("dialog: core");
|
|
|
|
|
2009-02-04 04:35:18 +00:00
|
|
|
test("title id", function() {
|
2012-05-30 04:11:42 +00:00
|
|
|
expect(1);
|
2009-02-04 04:35:18 +00:00
|
|
|
|
2012-11-03 20:17:16 +00:00
|
|
|
var titleId,
|
|
|
|
el = $('<div></div>').dialog();
|
|
|
|
|
|
|
|
titleId = el.dialog('widget').find('.ui-dialog-title').attr('id');
|
2012-05-30 04:11:42 +00:00
|
|
|
ok( /ui-id-\d+$/.test( titleId ), 'auto-numbered title id');
|
2009-02-04 04:35:18 +00:00
|
|
|
el.remove();
|
|
|
|
});
|
|
|
|
|
|
|
|
test("ARIA", function() {
|
|
|
|
expect(4);
|
|
|
|
|
2012-11-03 20:17:16 +00:00
|
|
|
var labelledBy,
|
|
|
|
el = $('<div></div>').dialog();
|
2009-02-04 04:35:18 +00:00
|
|
|
|
2012-11-03 20:17:16 +00:00
|
|
|
equal(el.dialog('widget').attr('role'), 'dialog', 'dialog role');
|
2009-02-04 04:35:18 +00:00
|
|
|
|
2012-11-03 20:17:16 +00:00
|
|
|
labelledBy = el.dialog('widget').attr('aria-labelledby');
|
2009-02-04 04:35:18 +00:00
|
|
|
ok(labelledBy.length > 0, 'has aria-labelledby attribute');
|
2012-11-03 20:17:16 +00:00
|
|
|
equal(el.dialog('widget').find('.ui-dialog-title').attr('id'), labelledBy,
|
2009-02-04 04:35:18 +00:00
|
|
|
'proper aria-labelledby attribute');
|
|
|
|
|
2012-11-03 20:17:16 +00:00
|
|
|
equal(el.dialog('widget').find('.ui-dialog-titlebar-close').attr('role'), 'button',
|
2009-02-04 04:35:18 +00:00
|
|
|
'close link role');
|
|
|
|
|
|
|
|
el.remove();
|
2009-02-02 14:36:08 +00:00
|
|
|
});
|
|
|
|
|
2010-01-07 03:19:50 +00:00
|
|
|
test("widget method", function() {
|
2012-06-27 15:32:48 +00:00
|
|
|
expect( 1 );
|
2011-08-04 01:43:52 +00:00
|
|
|
var dialog = $("<div>").appendTo("#main").dialog();
|
2012-02-28 14:56:32 +00:00
|
|
|
deepEqual(dialog.parent()[0], dialog.dialog("widget")[0]);
|
2010-01-07 03:19:50 +00:00
|
|
|
});
|
|
|
|
|
2009-02-02 14:36:08 +00:00
|
|
|
})(jQuery);
|