diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /testing/web-platform/tests/html/editing/editing-0 | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/editing/editing-0')
-rw-r--r-- | testing/web-platform/tests/html/editing/editing-0/writing-suggestions/writingsuggestions.html | 182 |
1 files changed, 162 insertions, 20 deletions
diff --git a/testing/web-platform/tests/html/editing/editing-0/writing-suggestions/writingsuggestions.html b/testing/web-platform/tests/html/editing/editing-0/writing-suggestions/writingsuggestions.html index 49e75000d3..664659d90a 100644 --- a/testing/web-platform/tests/html/editing/editing-0/writing-suggestions/writingsuggestions.html +++ b/testing/web-platform/tests/html/editing/editing-0/writing-suggestions/writingsuggestions.html @@ -29,13 +29,33 @@ test(function() { assert_true('writingSuggestions' in document.createElement('test-custom-element')); }, 'Test that the writingsuggestions attribute is available on custom elements.'); +test(function() { + let input = document.createElement('input'); + input.type = 'color'; + assert_true('writingSuggestions' in input); +}, 'Test that the writingsuggestions attribute is available on an input type which the attribute doesn\'t apply. The User Agent is responsible that writing suggestions are not applied to the element.'); + +test(function() { + let textarea = document.createElement('textarea'); + textarea.disabled = true; + assert_true('writingSuggestions' in textarea); +}, 'Test that the writingsuggestions attribute is available on a disabled element. The User Agent is responsible that writing suggestions are not applied to the element.'); + function testSetAttributeDirectly(IDLValue, contentValue, expectedIDLValue, expectedContentValue, testDescription) { test(function() { + let input_color = document.createElement('input'); + input_color.type = 'color'; + + let disabled_textarea = document.createElement('textarea'); + disabled_textarea.disabled = true; + const elements = [document.createElement('input'), document.createElement('textarea'), document.createElement('div'), document.createElement('span'), - document.createElement('test-custom-element') ]; + document.createElement('test-custom-element'), + disabled_textarea, + input_color ]; elements.forEach(function(element) { if (IDLValue != undefined) { @@ -55,7 +75,7 @@ testSetAttributeDirectly('true', undefined, 'true', 'true', 'Test setting the `w testSetAttributeDirectly(undefined, 'true', 'true', 'true', 'Test setting the `writingsuggestions` content attribute to `true` directly on the target element.'); testSetAttributeDirectly(true, undefined, 'true', 'true', 'Test setting the `writingsuggestions` IDL attribute to boolean `true` directly on the target element.'); testSetAttributeDirectly(undefined, true, 'true', 'true', 'Test setting the `writingsuggestions` content attribute to boolean `true` directly on the target element.'); -testSetAttributeDirectly('TrUe', undefined, 'true', 'true', 'Test setting the `writingsuggestions` IDL attribute to `TrUe` directly on the target element.'); +testSetAttributeDirectly('TrUe', undefined, 'true', 'TrUe', 'Test setting the `writingsuggestions` IDL attribute to `TrUe` directly on the target element.'); testSetAttributeDirectly(undefined, 'TrUe', 'true', 'TrUe', 'Test setting the `writingsuggestions` content attribute to `TrUe` directly on the target element.'); // Test setting either the `writingsuggestions` IDL or content attribute to some variation of 'false' directly on the target element. @@ -63,15 +83,15 @@ testSetAttributeDirectly('false', undefined, 'false', 'false', 'Test setting the testSetAttributeDirectly(undefined, 'false', 'false', 'false', 'Test setting the `writingsuggestions` content attribute to `false` directly on the target element.'); testSetAttributeDirectly(false, undefined, 'false', 'false', 'Test setting the `writingsuggestions` IDL attribute to boolean `false` directly on the target element.'); testSetAttributeDirectly(undefined, false, 'false', 'false', 'Test setting the `writingsuggestions` content attribute to boolean `false` directly on the target element.'); -testSetAttributeDirectly('FaLsE', undefined, 'false', 'false', 'Test setting the `writingsuggestions` IDL attribute to `FaLsE` directly on the target element.'); +testSetAttributeDirectly('FaLsE', undefined, 'false', 'FaLsE', 'Test setting the `writingsuggestions` IDL attribute to `FaLsE` directly on the target element.'); testSetAttributeDirectly(undefined, 'FaLsE', 'false', 'FaLsE', 'Test setting the `writingsuggestions` content attribute to `FaLsE` directly on the target element.'); // Test setting either the `writingsuggestions` IDL or content attribute to the empty string directly on the target element. -testSetAttributeDirectly('', undefined, 'true', 'true', 'Test setting the `writingsuggestions` IDL attribute to the empty string directly on the target element.'); +testSetAttributeDirectly('', undefined, 'true', '', 'Test setting the `writingsuggestions` IDL attribute to the empty string directly on the target element.'); testSetAttributeDirectly(undefined, '', 'true', '', 'Test setting the `writingsuggestions` content attribute to the empty string directly on the target element.'); // Test setting either the `writingsuggestions` IDL or content attribute to an invalid value directly on the target element. -testSetAttributeDirectly('foo', undefined, 'true', 'true', 'Test setting the `writingsuggestions` IDL attribute to an invalid value directly on the target element.'); +testSetAttributeDirectly('foo', undefined, 'true', 'foo', 'Test setting the `writingsuggestions` IDL attribute to an invalid value directly on the target element.'); testSetAttributeDirectly(undefined, 'foo', 'true', 'foo', 'Test setting the `writingsuggestions` content attribute to an invalid value directly on the target element.'); // Test setting neither the `writingsuggestions` IDL nor content attribute directly on the target element. @@ -98,7 +118,9 @@ test(function() { const elements = [ new DOMParser().parseFromString('<input writingsuggestions />', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<textarea writingsuggestions></textarea>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<div writingsuggestions></div>', 'text/html').body.firstElementChild, - new DOMParser().parseFromString('<span writingsuggestions></span>', 'text/html').body.firstElementChild ]; + new DOMParser().parseFromString('<span writingsuggestions></span>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<input type="color" writingsuggestions />', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<textarea disabled writingsuggestions></textarea>', 'text/html').body.firstElementChild ]; elements.forEach(function(element) { assert_equals(element.writingSuggestions, 'true'); @@ -110,7 +132,9 @@ test(function() { const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions="true"><input /></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="true"><textarea></textarea></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="true"><div></div></body></html>', 'text/html').body.firstElementChild, - new DOMParser().parseFromString('<html><body writingsuggestions="true"><span></span></body></html>', 'text/html').body.firstElementChild ]; + new DOMParser().parseFromString('<html><body writingsuggestions="true"><span></span></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="true"><input type="color"/></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="true"><textarea disabled></textarea></body></html>', 'text/html').body.firstElementChild ]; elements.forEach(function(element) { assert_equals(element.parentElement.writingSuggestions, 'true'); @@ -124,7 +148,9 @@ test(function() { const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions=""><input /></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions=""><textarea></textarea></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions=""><div></div></body></html>', 'text/html').body.firstElementChild, - new DOMParser().parseFromString('<html><body writingsuggestions=""><span></span></body></html>', 'text/html').body.firstElementChild ]; + new DOMParser().parseFromString('<html><body writingsuggestions=""><span></span></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions=""><input type="color"/></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions=""><textarea disabled></textarea></body></html>', 'text/html').body.firstElementChild ]; elements.forEach(function(element) { assert_equals(element.parentElement.writingSuggestions, 'true'); @@ -138,7 +164,9 @@ test(function() { const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions="false"><input /></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="false"><textarea></textarea></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="false"><div></div></body></html>', 'text/html').body.firstElementChild, - new DOMParser().parseFromString('<html><body writingsuggestions="false"><span></span></body></html>', 'text/html').body.firstElementChild ]; + new DOMParser().parseFromString('<html><body writingsuggestions="false"><span></span></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="false"><input type="color"/></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="false"><textarea disabled></textarea></body></html>', 'text/html').body.firstElementChild ]; elements.forEach(function(element) { assert_equals(element.parentElement.writingSuggestions, 'false'); @@ -152,7 +180,9 @@ test(function() { const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions="foo"><input /></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="foo"><textarea></textarea></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="foo"><div></div></body></html>', 'text/html').body.firstElementChild, - new DOMParser().parseFromString('<html><body writingsuggestions="foo"><span></span></body></html>', 'text/html').body.firstElementChild ]; + new DOMParser().parseFromString('<html><body writingsuggestions="foo"><span></span></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="foo"><input type="color"/></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="foo"><textarea disabled></textarea></body></html>', 'text/html').body.firstElementChild ]; elements.forEach(function(element) { assert_equals(element.parentElement.writingSuggestions, 'true'); @@ -163,10 +193,12 @@ test(function() { }, 'Test setting the `writingsuggestions` attribute to an invalid value on a parent element.'); test(function() { - const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions="true"><input writingsuggestions="false" /></body></html>', 'text/html').body.firstElementChild, + const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions="true"><input writingsuggestions="false"/></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="true"><textarea writingsuggestions="false"></textarea></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="true"><div writingsuggestions="false"></div></body></html>', 'text/html').body.firstElementChild, - new DOMParser().parseFromString('<html><body writingsuggestions="true"><span writingsuggestions="false"></span></body></html>', 'text/html').body.firstElementChild ]; + new DOMParser().parseFromString('<html><body writingsuggestions="true"><span writingsuggestions="false"></span></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="true"><input type="color" writingsuggestions="false"/></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="true"><textarea disabled writingsuggestions="false"></textarea></body></html>', 'text/html').body.firstElementChild ]; elements.forEach(function(element) { assert_equals(element.parentElement.writingSuggestions, 'true'); @@ -177,10 +209,12 @@ test(function() { }, 'Test overriding the parent element\'s `writingsuggestions` attribute from "true" to "false".'); test(function() { - const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions=""><input writingsuggestions="false" /></body></html>', 'text/html').body.firstElementChild, + const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions=""><input writingsuggestions="false"/></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions=""><textarea writingsuggestions="false"></textarea></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions=""><div writingsuggestions="false"></div></body></html>', 'text/html').body.firstElementChild, - new DOMParser().parseFromString('<html><body writingsuggestions=""><span writingsuggestions="false"></span></body></html>', 'text/html').body.firstElementChild ]; + new DOMParser().parseFromString('<html><body writingsuggestions=""><span writingsuggestions="false"></span></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions=""><input type="color" writingsuggestions="false"/></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions=""><textarea disabled writingsuggestions="false"></textarea></body></html>', 'text/html').body.firstElementChild ]; elements.forEach(function(element) { assert_equals(element.parentElement.writingSuggestions, 'true'); @@ -194,7 +228,9 @@ test(function() { const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions="false"><input writingsuggestions="true" /></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="false"><textarea writingsuggestions="true"></textarea></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="false"><div writingsuggestions="true"></div></body></html>', 'text/html').body.firstElementChild, - new DOMParser().parseFromString('<html><body writingsuggestions="false"><span writingsuggestions="true"></span></body></html>', 'text/html').body.firstElementChild ]; + new DOMParser().parseFromString('<html><body writingsuggestions="false"><span writingsuggestions="true"></span></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="false"><input type="color" writingsuggestions="true"/></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="false"><textarea disabled writingsuggestions="true"></textarea></body></html>', 'text/html').body.firstElementChild, ]; elements.forEach(function(element) { assert_equals(element.parentElement.writingSuggestions, 'false'); @@ -208,7 +244,9 @@ test(function() { const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions="false"><input writingsuggestions="foo" /></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="false"><textarea writingsuggestions="foo"></textarea></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="false"><div writingsuggestions="foo"></div></body></html>', 'text/html').body.firstElementChild, - new DOMParser().parseFromString('<html><body writingsuggestions="false"><span writingsuggestions="foo"></span></body></html>', 'text/html').body.firstElementChild ]; + new DOMParser().parseFromString('<html><body writingsuggestions="false"><span writingsuggestions="foo"></span></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="false"><input type="color" writingsuggestions="foo"/></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="false"><textarea disabled writingsuggestions="foo"></textarea></body></html>', 'text/html').body.firstElementChild ]; elements.forEach(function(element) { assert_equals(element.parentElement.writingSuggestions, 'false'); @@ -222,7 +260,9 @@ test(function() { const elements = [ new DOMParser().parseFromString('<html><body writingsuggestions="false"><input writingsuggestions="" /></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="false"><textarea writingsuggestions=""></textarea></body></html>', 'text/html').body.firstElementChild, new DOMParser().parseFromString('<html><body writingsuggestions="false"><div writingsuggestions=""></div></body></html>', 'text/html').body.firstElementChild, - new DOMParser().parseFromString('<html><body writingsuggestions="false"><span writingsuggestions=""></span></body></html>', 'text/html').body.firstElementChild ]; + new DOMParser().parseFromString('<html><body writingsuggestions="false"><span writingsuggestions=""></span></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="false"><input type="color" writingsuggestions=""/></body></html>', 'text/html').body.firstElementChild, + new DOMParser().parseFromString('<html><body writingsuggestions="false"><textarea disabled writingsuggestions=""></textarea></body></html>', 'text/html').body.firstElementChild ]; elements.forEach(function(element) { assert_equals(element.parentElement.writingSuggestions, 'false'); @@ -233,13 +273,15 @@ test(function() { }, 'Test overriding the parent element\'s `writingsuggestions` attribute from "false" to the empty string.'); test(function() { - const doc = new DOMParser().parseFromString('<html writingsuggestions="false"><body><input /><textarea></textarea><div></div><span></span></body></html>', 'text/html'); + const doc = new DOMParser().parseFromString('<html writingsuggestions="false"><body><input /><textarea></textarea><div></div><span></span><input type="color"/><textarea disabled></textarea></body></html>', 'text/html'); assert_equals(doc.documentElement.writingSuggestions, 'false'); assert_equals(doc.body.writingSuggestions, 'false'); - assert_equals(doc.querySelector('input').writingSuggestions, 'false'); - assert_equals(doc.querySelector('textarea').writingSuggestions, 'false'); + assert_equals(doc.querySelectorAll('input')[0].writingSuggestions, 'false'); + assert_equals(doc.querySelectorAll('textarea')[0].writingSuggestions, 'false'); assert_equals(doc.querySelector('div').writingSuggestions, 'false'); assert_equals(doc.querySelector('span').writingSuggestions, 'false'); + assert_equals(doc.querySelectorAll('input')[1].writingSuggestions, 'false'); + assert_equals(doc.querySelectorAll('textarea')[1].writingSuggestions, 'false'); }, 'Test turning off writing suggestions for an entire document.'); test(function() { @@ -283,6 +325,26 @@ test(function() { }, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on a span element from "false" to "true".'); test(function() { + const doc = new DOMParser().parseFromString('<html writingsuggestions="false"><body><input type="color" writingsuggestions="true"><textarea></textarea><div></div><span></span></body></html>', 'text/html'); + assert_equals(doc.documentElement.writingSuggestions, 'false'); + assert_equals(doc.body.writingSuggestions, 'false'); + assert_equals(doc.querySelector('input').writingSuggestions, 'true'); + assert_equals(doc.querySelector('textarea').writingSuggestions, 'false'); + assert_equals(doc.querySelector('div').writingSuggestions, 'false'); + assert_equals(doc.querySelector('span').writingSuggestions, 'false'); +}, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on an input type which the attribute doesn\'t apply from "false" to "true". The User Agent is responsible that writing suggestions are not applied to the element'); + +test(function() { + const doc = new DOMParser().parseFromString('<html writingsuggestions="false"><body><input><textarea disabled writingsuggestions="true"></textarea><div></div><span></span></body></html>', 'text/html'); + assert_equals(doc.documentElement.writingSuggestions, 'false'); + assert_equals(doc.body.writingSuggestions, 'false'); + assert_equals(doc.querySelector('input').writingSuggestions, 'false'); + assert_equals(doc.querySelector('textarea').writingSuggestions, 'true'); + assert_equals(doc.querySelector('div').writingSuggestions, 'false'); + assert_equals(doc.querySelector('span').writingSuggestions, 'false'); +}, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on a disabled textarea element from "false" to "true". The User Agent is responsible that writing suggestions are not applied to the element'); + +test(function() { const doc = new DOMParser().parseFromString('<html writingsuggestions="false"><body><input writingsuggestions=""><textarea></textarea><div></div><span></span></body></html>', 'text/html'); assert_equals(doc.documentElement.writingSuggestions, 'false'); assert_equals(doc.body.writingSuggestions, 'false'); @@ -323,6 +385,26 @@ test(function() { }, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on a span element from "false" to the empty string.'); test(function() { + const doc = new DOMParser().parseFromString('<html writingsuggestions="false"><body><input type="color" writingsuggestions=""><textarea></textarea><div></div><span></span></body></html>', 'text/html'); + assert_equals(doc.documentElement.writingSuggestions, 'false'); + assert_equals(doc.body.writingSuggestions, 'false'); + assert_equals(doc.querySelector('input').writingSuggestions, 'true'); + assert_equals(doc.querySelector('textarea').writingSuggestions, 'false'); + assert_equals(doc.querySelector('div').writingSuggestions, 'false'); + assert_equals(doc.querySelector('span').writingSuggestions, 'false'); +}, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on an input type which the attribute doesn\'t apply from "false" to the empty string. The User Agent is responsible that writing suggestions are not applied to the element.'); + +test(function() { + const doc = new DOMParser().parseFromString('<html writingsuggestions="false"><body><input><textarea disabled writingsuggestions=""></textarea><div></div><span></span></body></html>', 'text/html'); + assert_equals(doc.documentElement.writingSuggestions, 'false'); + assert_equals(doc.body.writingSuggestions, 'false'); + assert_equals(doc.querySelector('input').writingSuggestions, 'false'); + assert_equals(doc.querySelector('textarea').writingSuggestions, 'true'); + assert_equals(doc.querySelector('div').writingSuggestions, 'false'); + assert_equals(doc.querySelector('span').writingSuggestions, 'false'); +}, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on a disabled textarea element from "false" to the empty string. The User Agent is responsible that writing suggestions are not applied to the element.'); + +test(function() { const doc = new DOMParser().parseFromString('<html writingsuggestions="false"><body><input writingsuggestions="foo"><textarea></textarea><div></div><span></span></body></html>', 'text/html'); assert_equals(doc.documentElement.writingSuggestions, 'false'); assert_equals(doc.body.writingSuggestions, 'false'); @@ -363,6 +445,26 @@ test(function() { }, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on a span element from "false" to an invalid value.'); test(function() { + const doc = new DOMParser().parseFromString('<html writingsuggestions="false"><body><input type="color" writingsuggestions="foo"><textarea></textarea><div></div><span></span></body></html>', 'text/html'); + assert_equals(doc.documentElement.writingSuggestions, 'false'); + assert_equals(doc.body.writingSuggestions, 'false'); + assert_equals(doc.querySelector('input').writingSuggestions, 'true'); + assert_equals(doc.querySelector('textarea').writingSuggestions, 'false'); + assert_equals(doc.querySelector('div').writingSuggestions, 'false'); + assert_equals(doc.querySelector('span').writingSuggestions, 'false'); +}, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on an input type which the attribute doesn\'t apply from "false" to an invalid value. The User Agent is responsible that writing suggestions are not applied to the element.'); + +test(function() { + const doc = new DOMParser().parseFromString('<html writingsuggestions="false"><body><input><textarea disabled writingsuggestions="foo"></textarea><div></div><span></span></body></html>', 'text/html'); + assert_equals(doc.documentElement.writingSuggestions, 'false'); + assert_equals(doc.body.writingSuggestions, 'false'); + assert_equals(doc.querySelector('input').writingSuggestions, 'false'); + assert_equals(doc.querySelector('textarea').writingSuggestions, 'true'); + assert_equals(doc.querySelector('div').writingSuggestions, 'false'); + assert_equals(doc.querySelector('span').writingSuggestions, 'false'); +}, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on a disabled textarea element from "false" to an invalid value. The User Agent is responsible that writing suggestions are not applied to the element.'); + +test(function() { const doc = new DOMParser().parseFromString('<html writingsuggestions="true"><body><input writingsuggestions="false"><textarea></textarea><div></div><span></span></body></html>', 'text/html'); assert_equals(doc.documentElement.writingSuggestions, 'true'); assert_equals(doc.body.writingSuggestions, 'true'); @@ -403,6 +505,26 @@ test(function() { }, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on a span element from "true" to "false".'); test(function() { + const doc = new DOMParser().parseFromString('<html writingsuggestions="true"><body><input type="color" writingsuggestions="false"><textarea></textarea><div></div><span></span></body></html>', 'text/html'); + assert_equals(doc.documentElement.writingSuggestions, 'true'); + assert_equals(doc.body.writingSuggestions, 'true'); + assert_equals(doc.querySelector('input').writingSuggestions, 'false'); + assert_equals(doc.querySelector('textarea').writingSuggestions, 'true'); + assert_equals(doc.querySelector('div').writingSuggestions, 'true'); + assert_equals(doc.querySelector('span').writingSuggestions, 'true'); +}, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on an input type which the attribute doesn\'t apply from "true" to "false". The User Agent is responsible that writing suggestions are not applied to the element.'); + +test(function() { + const doc = new DOMParser().parseFromString('<html writingsuggestions="true"><body><input><textarea disabled writingsuggestions="false"></textarea><div></div><span></span></body></html>', 'text/html'); + assert_equals(doc.documentElement.writingSuggestions, 'true'); + assert_equals(doc.body.writingSuggestions, 'true'); + assert_equals(doc.querySelector('input').writingSuggestions, 'true'); + assert_equals(doc.querySelector('textarea').writingSuggestions, 'false'); + assert_equals(doc.querySelector('div').writingSuggestions, 'true'); + assert_equals(doc.querySelector('span').writingSuggestions, 'true'); +}, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on a disabled textarea element from "true" to "false". The User Agent is responsible that writing suggestions are not applied to the element.'); + +test(function() { const doc = new DOMParser().parseFromString('<html writingsuggestions=""><body><input writingsuggestions="false"><textarea></textarea><div></div><span></span></body></html>', 'text/html'); assert_equals(doc.documentElement.writingSuggestions, 'true'); assert_equals(doc.body.writingSuggestions, 'true'); @@ -443,6 +565,26 @@ test(function() { }, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on a span element from the empty string to "false".'); test(function() { + const doc = new DOMParser().parseFromString('<html writingsuggestions=""><body><input type="color" writingsuggestions="false"><textarea></textarea><div></div><span></span></body></html>', 'text/html'); + assert_equals(doc.documentElement.writingSuggestions, 'true'); + assert_equals(doc.body.writingSuggestions, 'true'); + assert_equals(doc.querySelector('input').writingSuggestions, 'false'); + assert_equals(doc.querySelector('textarea').writingSuggestions, 'true'); + assert_equals(doc.querySelector('div').writingSuggestions, 'true'); + assert_equals(doc.querySelector('span').writingSuggestions, 'true'); +}, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on an input type which the attribute doesn\'t apply from the empty string to "false". The User Agent is responsible that writing suggestions are not applied to the element.'); + +test(function() { + const doc = new DOMParser().parseFromString('<html writingsuggestions=""><body><input><textarea disabled writingsuggestions="false"></textarea><div></div><span></span></body></html>', 'text/html'); + assert_equals(doc.documentElement.writingSuggestions, 'true'); + assert_equals(doc.body.writingSuggestions, 'true'); + assert_equals(doc.querySelector('input').writingSuggestions, 'true'); + assert_equals(doc.querySelector('textarea').writingSuggestions, 'false'); + assert_equals(doc.querySelector('div').writingSuggestions, 'true'); + assert_equals(doc.querySelector('span').writingSuggestions, 'true'); +}, 'Test overriding a non-parent ancestor element\'s `writingsuggestions` attribute on a disabled textarea element from the empty string to "false". The User Agent is responsible that writing suggestions are not applied to the element.'); + +test(function() { const doc = new DOMParser().parseFromString('<html writingsuggestions="true"><body><div contenteditable="true"><span>Writing suggestions allowed.</span> <span writingsuggestions="false">Writing suggestions not allowed.</span></div></body></html>', 'text/html'); const div = doc.querySelector('div'); const span1 = doc.querySelector('span'); |