Bug 1823464 - [wdspec] Improve serialization tests for DOMTokenList. r=webdriver-reviewers,jdescottes

Depends on D173068

Differential Revision: https://phabricator.services.mozilla.com/D173069
This commit is contained in:
Henrik Skupin 2023-03-21 18:28:36 +00:00
parent 43234ab776
commit b2e13b6cb8
3 changed files with 31 additions and 0 deletions

View File

@ -23,6 +23,17 @@ def test_array(session):
assert_success(response, [1, 2])
def test_dom_token_list(session, inline):
session.url = inline("""<div class="no cheese">foo</div>""")
element = session.find.css("div", all=False)
response = execute_async_script(
session, "arguments[1](arguments[0].classList)", args=[element])
value = assert_success(response)
assert value == ["no", "cheese"]
def test_file_list(session, tmpdir, inline):
files = [tmpdir.join("foo.txt"), tmpdir.join("bar.txt")]

View File

@ -19,6 +19,16 @@ def test_array(session):
assert_success(response, [1, 2])
def test_dom_token_list(session, inline):
session.url = inline("""<div class="no cheese">foo</div>""")
element = session.find.css("div", all=False)
response = execute_script(session, "return arguments[0].classList", args=[element])
value = assert_success(response)
assert value == ["no", "cheese"]
def test_file_list(session, tmpdir, inline):
files = [tmpdir.join("foo.txt"), tmpdir.join("bar.txt")]

View File

@ -137,6 +137,16 @@ def test_primitives(session, inline, js_primitive, py_primitive):
assert_success(response, py_primitive)
def test_collection_dom_token_list(session, inline):
session.url = inline("""<div class="no cheese">""")
element = session.find.css("div", all=False)
response = get_element_property(session, element.id, "classList")
value = assert_success(response)
assert value == ["no", "cheese"]
@pytest.mark.parametrize("js_primitive,py_primitive", [
("\"foobar\"", "foobar"),
(42, 42),