Skip to content

Commit

Permalink
Bug 1823464 - [wdspec] Improve serialization tests for DOMTokenList. …
Browse files Browse the repository at this point in the history
…r=webdriver-reviewers,jdescottes

Depends on D173068

Differential Revision: https://phabricator.services.mozilla.com/D173069
  • Loading branch information
whimboo committed Mar 21, 2023
1 parent 43234ab commit b2e13b6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit b2e13b6

Please sign in to comment.