blob: 7f4c44015b4e2fffe5e17c98eb136ca31c0aa6ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
description('Test the disabled property on a style element.');
var styleElement = document.getElementById('s');
var console = document.getElementById('console');
var testElement = document.createElement('div');
testElement.innerText = "Test element";
testElement.className = 'test';
document.body.appendChild(testElement);
shouldBeFalse('styleElement.disabled');
shouldBe('window.getComputedStyle(testElement).color', '"rgb(0, 128, 0)"');
styleElement.disabled = true
shouldBeTrue('styleElement.disabled');
shouldBe('window.getComputedStyle(testElement).color', '"rgb(255, 0, 0)"');
// Test reflection in the sheet.
shouldBeTrue('styleElement.sheet.disabled');
styleElement.sheet.disabled = false
shouldBeFalse('styleElement.sheet.disabled');
shouldBeFalse('styleElement.disabled');
shouldBe('window.getComputedStyle(testElement).color', '"rgb(0, 128, 0)"');
// Test disconnected element
var newStyleElement = document.createElement('style');
shouldBeFalse('newStyleElement.disabled');
newStyleElement.disabled = true
shouldBeFalse('newStyleElement.disabled');
// Test non-CSS element
var otherStyle = document.getElementById('non-css');
shouldBeFalse('otherStyle.disabled');
otherStyle.disabled = true
shouldBeFalse('otherStyle.disabled');
document.body.removeChild(testElement);
|