| OLD | NEW |
| (Empty) |
| 1 description('Tests for assigning the value attribute to output elements.'); | |
| 2 | |
| 3 var output; | |
| 4 var childNode; | |
| 5 | |
| 6 debug('- Sets the defaultValue attribute with the value mode flag is in mode "de
falut".'); | |
| 7 output = document.createElement('output'); | |
| 8 output.defaultValue = "defaultValue"; | |
| 9 shouldBeEqualToString('output.defaultValue', 'defaultValue'); | |
| 10 shouldBeEqualToString('output.value', 'defaultValue'); | |
| 11 shouldBeEqualToString('output.innerText', 'defaultValue'); | |
| 12 shouldBeEqualToString('output.innerHTML', 'defaultValue'); | |
| 13 | |
| 14 debug('- Sets the value attribute. This will change the value mode flag from "de
fault" to "value".'); | |
| 15 | |
| 16 output.value = 'aValue'; | |
| 17 shouldBeEqualToString('output.defaultValue', 'defaultValue'); | |
| 18 shouldBeEqualToString('output.value', 'aValue'); | |
| 19 shouldBeEqualToString('output.innerText', 'aValue'); | |
| 20 shouldBeEqualToString('output.innerHTML', 'aValue'); | |
| 21 | |
| 22 debug('- Sets the defaultValue attribute with the value mode flag is in mode "va
lue".'); | |
| 23 output.defaultValue = 'another defaultValue'; | |
| 24 shouldBeEqualToString('output.defaultValue', 'another defaultValue'); | |
| 25 shouldBeEqualToString('output.value', 'aValue'); | |
| 26 shouldBeEqualToString('output.innerText', 'aValue'); | |
| 27 shouldBeEqualToString('output.innerHTML', 'aValue'); | |
| 28 | |
| 29 debug('- Ensures that setting text to the value attribute works as setTextConten
t().'); | |
| 30 output.value = '<strong>A <span style=\"color: red;\">strong</span> text</strong
>'; | |
| 31 shouldBe('output.value', '\'<strong>A <span style="color: red;">strong</span> te
xt</strong>\''); | |
| 32 shouldBe('output.innerText', '\'<strong>A <span style="color: red;">strong</span
> text</strong>\''); | |
| 33 shouldBe('output.innerHTML', '\'<strong>A <span style="color: red;">
strong</span> text</strong>\''); | |
| 34 | |
| 35 debug('- Sets the innerText attribute with the value mode flag is in mode "defau
lt".'); | |
| 36 output = document.createElement('output'); | |
| 37 output.innerText = 'text'; | |
| 38 shouldBeEqualToString('output.defaultValue', 'text'); | |
| 39 shouldBeEqualToString('output.value', 'text'); | |
| 40 shouldBeEqualToString('output.innerText', 'text'); | |
| 41 shouldBeEqualToString('output.innerHTML', 'text'); | |
| 42 | |
| 43 output.innerText = '<strong>strong</strong> text'; | |
| 44 shouldBeEqualToString('output.defaultValue', '<strong>strong</strong> text'); | |
| 45 shouldBeEqualToString('output.value', '<strong>strong</strong> text'); | |
| 46 shouldBeEqualToString('output.innerText', '<strong>strong</strong> text'); | |
| 47 shouldBeEqualToString('output.innerHTML', '<strong>strong</strong> t
ext'); | |
| 48 | |
| 49 debug('- Sets the innerText attribute with the value mode flag is in mode "value
".'); | |
| 50 output = document.createElement('output'); | |
| 51 output.value = 'aValue'; | |
| 52 output.defaultValue = 'defaultValue'; | |
| 53 output.innerText = 'text'; | |
| 54 shouldBeEqualToString('output.defaultValue', 'defaultValue'); | |
| 55 shouldBeEqualToString('output.value', 'text'); | |
| 56 shouldBeEqualToString('output.innerText', 'text'); | |
| 57 shouldBeEqualToString('output.innerHTML', 'text'); | |
| 58 | |
| 59 debug('- Sets the innerHTML attribute with the value mode flag is in mode "defau
lt".'); | |
| 60 output = document.createElement('output'); | |
| 61 output.innerHTML = 'text'; | |
| 62 shouldBeEqualToString('output.defaultValue', 'text'); | |
| 63 shouldBeEqualToString('output.value', 'text'); | |
| 64 shouldBeEqualToString('output.innerText', 'text'); | |
| 65 shouldBeEqualToString('output.innerHTML', 'text'); | |
| 66 | |
| 67 output.innerHTML = '<strong>strong</strong> text'; | |
| 68 shouldBeEqualToString('output.defaultValue', 'strong text'); | |
| 69 shouldBeEqualToString('output.value', 'strong text'); | |
| 70 shouldBeEqualToString('output.innerText', 'strong text'); | |
| 71 shouldBeEqualToString('output.innerHTML', '<strong>strong</strong> text'); | |
| 72 | |
| 73 debug('- Sets the innerHTML attribute with the value mode flag is in mode "value
".'); | |
| 74 output = document.createElement('output'); | |
| 75 output.value = 'aValue'; | |
| 76 output.defaultValue = 'defaultValue'; | |
| 77 output.innerHTML = 'text'; | |
| 78 shouldBeEqualToString('output.defaultValue', 'defaultValue'); | |
| 79 shouldBeEqualToString('output.value', 'text'); | |
| 80 shouldBeEqualToString('output.innerText', 'text'); | |
| 81 shouldBeEqualToString('output.innerHTML', 'text'); | |
| 82 | |
| 83 output.innerHTML = '<strong>strong</strong> text'; | |
| 84 shouldBeEqualToString('output.defaultValue', 'defaultValue'); | |
| 85 shouldBeEqualToString('output.value', 'strong text'); | |
| 86 shouldBeEqualToString('output.innerText', 'strong text'); | |
| 87 shouldBeEqualToString('output.innerHTML', '<strong>strong</strong> text'); | |
| 88 | |
| 89 debug('- Appends a child node to the output element with the value mode flag is
in mode "default".'); | |
| 90 output = document.createElement('output'); | |
| 91 childNode = document.createElement('span'); | |
| 92 childNode.innerText = 'childText'; | |
| 93 output.appendChild(childNode); | |
| 94 shouldBeEqualToString('output.defaultValue', 'childText'); | |
| 95 shouldBeEqualToString('output.value', 'childText'); | |
| 96 shouldBeEqualToString('output.innerText', 'childText'); | |
| 97 shouldBeEqualToString('output.innerHTML', '<span>childText</span>'); | |
| 98 debug('- Then removes the child node from the output element with the value mode
flag is in mode "default".'); | |
| 99 output.removeChild(childNode); | |
| 100 shouldBeEqualToString('output.defaultValue', ''); | |
| 101 shouldBeEqualToString('output.value', ''); | |
| 102 shouldBeEqualToString('output.innerText', ''); | |
| 103 shouldBeEqualToString('output.innerHTML', ''); | |
| 104 | |
| 105 debug('- Appends a child node to the output element with the value mode flag is
in mode "value".'); | |
| 106 output = document.createElement('output'); | |
| 107 output.value = 'aValue'; | |
| 108 output.defaultValue = 'defaultValue'; | |
| 109 childNode = document.createElement('span'); | |
| 110 childNode.innerText = ' and childText'; | |
| 111 output.appendChild(childNode); | |
| 112 shouldBeEqualToString('output.defaultValue', 'defaultValue'); | |
| 113 shouldBeEqualToString('output.value', 'aValue and childText'); | |
| 114 shouldBeEqualToString('output.innerText', 'aValue and childText'); | |
| 115 shouldBeEqualToString('output.innerHTML', 'aValue<span> and childText</span>'); | |
| 116 debug('- Then removes the child node from the output element with the value mode
flag is in mode "default".'); | |
| 117 output.removeChild(childNode); | |
| 118 shouldBeEqualToString('output.defaultValue', 'defaultValue'); | |
| 119 shouldBeEqualToString('output.value', 'aValue'); | |
| 120 shouldBeEqualToString('output.innerText', 'aValue'); | |
| 121 shouldBeEqualToString('output.innerHTML', 'aValue'); | |
| OLD | NEW |