| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script> |
| description('Test to see if setting the value attribute updates the value.'); |
| |
| var input = document.createElement('input'); |
| input.type = 'range'; |
| |
| shouldBe('input.setAttribute("value", "10"); input.value', '"10"'); |
| |
| input.setAttribute('min', '0'); |
| input.setAttribute('max', '100'); |
| |
| debug("rewriting the value attribute should update the value") |
| shouldBe('input.setAttribute("value", "20"); input.value', '"20"'); |
| |
| debug("changing the max should effect value") |
| shouldBe('input.setAttribute("max", "10"); input.value', '"10"'); |
| |
| debug("value attribute should not change the value after you set a value") |
| shouldBe('input.value = 10; input.setAttribute("value", "5"); input.value', '"10"'); |
| |
| debug('Updating step attribute should adjust the last value.'); |
| input = document.createElement('input'); |
| input.type = 'range'; |
| input.step = '10'; |
| shouldBeEqualToString('input.value', '50'); |
| shouldBeEqualToString('input.step = "15"; input.value', '45'); |
| shouldBeEqualToString('input.step = "20"; input.value', '40'); |
| </script> |
| </body> |
| </html> |