/*
- * core unit tests
+ * selector unit tests
*/
(function($) {
ok($(selector).length && !$(selector).is(':tabbable'), msg);
}
+test("data", function() {
+ expect(15);
+
+ var el;
+ function shouldHaveData(msg) {
+ ok(el.is(':data(test)'), msg);
+ }
+ function shouldNotHaveData(msg) {
+ ok(!el.is(':data(test)'), msg);
+ }
+
+ el = $('<div/>');
+ shouldNotHaveData('data never set');
+
+ el = $('<div/>').data('test', null);
+ shouldNotHaveData('data is null');
+
+ el = $('<div/>').data('test', true);
+ shouldHaveData('data set to true');
+
+ el = $('<div/>').data('test', false);
+ shouldNotHaveData('data set to false');
+
+ el = $('<div/>').data('test', 0);
+ shouldNotHaveData('data set to 0');
+
+ el = $('<div/>').data('test', 1);
+ shouldHaveData('data set to 1');
+
+ el = $('<div/>').data('test', '');
+ shouldNotHaveData('data set to empty string');
+
+ el = $('<div/>').data('test', 'foo');
+ shouldHaveData('data set to string');
+
+ el = $('<div/>').data('test', []);
+ shouldHaveData('data set to empty array');
+
+ el = $('<div/>').data('test', [1]);
+ shouldHaveData('data set to array');
+
+ el = $('<div/>').data('test', {});
+ shouldHaveData('data set to empty object');
+
+ el = $('<div/>').data('test', {foo: 'bar'});
+ shouldHaveData('data set to object');
+
+ el = $('<div/>').data('test', new Date());
+ shouldHaveData('data set to date');
+
+ el = $('<div/>').data('test', /test/);
+ shouldHaveData('data set to regexp');
+
+ el = $('<div/>').data('test', function() {});
+ shouldHaveData('data set to function');
+});
+
test("focusable - visible, enabled elements", function() {
expect(18);