3 module("cowhide-button", {
5 // Resets the driving state
6 $.cowhide.setDrivingMode(false)
10 test("should be disabled when driving", function () {
11 var page = $('<div class="page"></div>')
12 var btn = $('<button class="btn">test</button>')
15 $.cowhide.setDrivingMode(true)
17 setTimeout(function () {
18 ok(btn.attr('disabled'), 'btn is disabled')
19 ok(btn.hasClass('disabled'), 'btn has disabled class')
24 test("should support ignore-driving-mode", function () {
25 var page = $('<div class="page"></div>')
26 var btn = $('<button class="btn" data-ignore-driving-mode="true">test</button>')
29 $.cowhide.setDrivingMode(true)
31 setTimeout(function () {
32 ok(!btn.attr('disabled'), 'btn is disabled')
33 ok(!btn.hasClass('disabled'), 'btn has disabled class')
39 test("should have marquee element if marquee is enabled", function() {
40 var page = $('<div class="page"></div>')
41 var btn = $('<button class="btn" data-marquee="true">this is some really long text, for a button, is it not?</button>')
45 setTimeout(function () {
46 equal(btn.find('marquee').length, 1, 'marquee tag is present')
51 test("marquee should be removed when driving", function() {
52 var page = $('<div class="page"></div>')
53 var btn = $('<button class="btn" data-marquee="true">test</button>')
55 btn.ch_button('marquee')
56 $.cowhide.setDrivingMode(true)
58 setTimeout(function () {
59 equal(btn.find('marquee').length, 0, 'marquee tag is missing')
64 test("marquee should be enabled again when driving stops", function() {
65 var page = $('<div class="page"></div>')
66 var btn = $('<button class="btn" data-marquee="true">test</button>')
68 btn.ch_button('marquee')
69 $.cowhide.setDrivingMode(true)
70 $.cowhide.setDrivingMode(false)
72 setTimeout(function () {
73 equal(btn.find('marquee').length, 1, 'marquee tag is present')
78 test("should respect fixed width requirement", function() {
79 var page = $('<div class="page"></div>')
80 var btn = $('<button class="btn" data-fixed-width="200">this is some really long text, for a button, is it not?</button>')
84 setTimeout(function () {
85 equal(btn.css('width'), '200px', 'width is 200px')
90 test("should respect minimum font size requirement", function() {
91 var page = $('<div class="page"></div>')
92 var btn = $('<button class="btn">test</button>')
95 btn.css('font-size', '1px');
97 $.cowhide.verifyFrameworkRestrictions()
98 }, Error, "core throws Error")
101 test("should respect maximum font size requirement", function() {
102 var page = $('<div class="page"></div>')
103 var btn = $('<button class="btn">test</button>')
106 btn.css('font-size', '100px');
108 $.cowhide.verifyFrameworkRestrictions()
109 }, Error, "core throws Error")