Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/css/pseudo-default-dynamic.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/css/pseudo-default-dynamic.html b/third_party/WebKit/LayoutTests/fast/css/pseudo-default-dynamic.html |
| index 73a2893c04ba11c79872b53db37e2d79bbca6d21..2e0f72df9f2d7c497a208ea5c6434deb45a707c7 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/css/pseudo-default-dynamic.html |
| +++ b/third_party/WebKit/LayoutTests/fast/css/pseudo-default-dynamic.html |
| @@ -4,8 +4,8 @@ |
| <div id="log"></div> |
| <div id="container"></div> |
| <style> |
| -button, input { background: red; } |
| -button:default, input:default { background: green; } |
| +button, input, option { background: red; } |
| +button:default, input:default, option:default { background: green; } |
| </style> |
| <script> |
| // TODO(tkent): This should be merged to web-platform-tests/html/semantics/selectors/pseudo-classes/default.html. |
| @@ -86,4 +86,79 @@ test(function() { |
| assert_equals(background('second'), NOT_DEFAULT); |
| }, 'Adding a button by form content attribute should update the default button.'); |
| +test(function() { |
| + container.innerHTML = '<form><input type=checkbox checked id=c1><input type=text checked id=t1></form>'; |
| + assert_equals(background('c1'), DEFAULT); |
| + assert_equals(background('t1'), NOT_DEFAULT); |
| + document.querySelector('#c1').type = 'text'; |
| + document.querySelector('#t1').type = 'checkbox'; |
| + assert_equals(background('c1'), NOT_DEFAULT); |
| + assert_equals(background('t1'), DEFAULT); |
| +}, 'Updating type attribute of :default checkbox should update default status'); |
| + |
| +test(function() { |
| + container.innerHTML = '<form><input type=radio checked id=r1><input type=text checked id=t1></form>'; |
| + assert_equals(background('r1'), DEFAULT); |
| + assert_equals(background('t1'), NOT_DEFAULT); |
| + document.querySelector('#r1').type = 'text'; |
| + document.querySelector('#t1').type = 'radio'; |
| + assert_equals(background('r1'), NOT_DEFAULT); |
| + assert_equals(background('t1'), DEFAULT); |
| +}, 'Updating type attribute of :default radio should update default status'); |
| + |
| +test(function() { |
| + container.innerHTML = '<form><input type=checkbox checked id=c1><input type=radio checked id=r1></form>'; |
| + assert_equals(background('c1'), DEFAULT); |
| + assert_equals(background('r1'), DEFAULT); |
| + document.querySelector('#c1').defaultChecked = false; |
| + document.querySelector('#r1').defaultChecked = false; |
| + assert_equals(background('c1'), NOT_DEFAULT); |
| + assert_equals(background('r1'), NOT_DEFAULT); |
| +}, 'Updating the checked attribute of :default checkbox or radio should update default status'); |
| + |
| +test(function() { |
| + container.innerHTML = '<form><input type=checkbox id=second></form>'; |
| + assert_equals(background('second'), NOT_DEFAULT); |
| + var input = document.createElement('input'); |
| + input.id='added'; |
| + input.type = 'checkbox'; |
| + input.defaultChecked = true; |
| + document.querySelector('form').insertBefore(input, document.querySelector('#second')); |
| + assert_equals(background('added'), DEFAULT); |
| +}, 'Adding a checkbox with checked attribute dynamically to a DOM tree should reflect the default checkbox.'); |
|
tkent
2016/03/07 05:22:34
Plese remove this test.
This test isn't helpful be
ramya.v
2016/03/07 10:03:02
Done.
|
| + |
| +test(function() { |
| + container.innerHTML = '<form><input type=radio id=second></form>'; |
| + assert_equals(background('second'), NOT_DEFAULT); |
| + var input = document.createElement('input'); |
| + input.id='added'; |
| + input.type = 'radio'; |
| + input.defaultChecked = true; |
| + document.querySelector('form').insertBefore(input, document.querySelector('#second')); |
| + assert_equals(background('added'), DEFAULT); |
| +}, 'Adding a radio element with checked attribute dynamically to a DOM tree should reflect the default radio element.'); |
|
tkent
2016/03/07 05:22:33
Ditto.
ramya.v
2016/03/07 10:03:02
Done.
|
| + |
| +test(function() { |
| + container.innerHTML = '<form><select><option selected id=o1>1</option><option id=o2>2</option></select></form>'; |
| + assert_equals(background('o1'), DEFAULT); |
| + assert_equals(background('o2'), NOT_DEFAULT); |
| + document.querySelector('#o1').defaultSelected = false; |
| + document.querySelector('#o2').defaultSelected = true; |
| + assert_equals(background('o1'), NOT_DEFAULT); |
| + assert_equals(background('o2'), DEFAULT); |
| + |
| +}, 'Updating the selected attribute of :default option element should update default status'); |
| + |
| +test(function() { |
| + container.innerHTML = '<form><select><option id=first>1</option></select></form>'; |
| + assert_equals(background('first'), NOT_DEFAULT); |
| + var option = document.createElement('option'); |
| + option.id='added'; |
| + option.value = '2'; |
| + option.defaultSelected = true; |
| + document.querySelector('select').appendChild(option); |
| + assert_equals(background('added'), DEFAULT); |
| + |
| +}, 'Adding an option element dynamically to a DOM tree should reflect default option element.'); |
|
tkent
2016/03/07 05:22:33
Ditto.
ramya.v
2016/03/07 10:03:02
Done.
|
| + |
| </script> |
|
tkent
2016/03/07 05:22:34
Please add the following tests:
* A radio/checkbo
ramya.v
2016/03/07 10:03:02
Done.
|