Skip to content

Commit

Permalink
fix locator_assertion definition
Browse files Browse the repository at this point in the history
  • Loading branch information
YusukeIwaki committed Dec 10, 2023
1 parent 533b24f commit 8a7271b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions lib/playwright/locator_assertions_impl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def initialize(locator, timeout, is_not, message)
expected
end

private def to_expected_text_values(items, match_substring = false, normalize_white_space = false, ignore_case = false)
private def to_expected_text_values(items, match_substring: false, normalize_white_space: false, ignore_case: false)
return [] unless items.respond_to?(:each)

items.each.with_object([]) do |item, out|
Expand Down Expand Up @@ -109,9 +109,9 @@ def to_contain_text(expected, ignoreCase: nil, timeout: nil, useInnerText: nil)
if expected.respond_to?(:each)
expected_text = to_expected_text_values(
expected,
true,
true,
ignoreCase,
match_substring: true,
normalize_white_space: true,
ignore_case: ignoreCase,
)

expect_impl(
Expand All @@ -127,9 +127,9 @@ def to_contain_text(expected, ignoreCase: nil, timeout: nil, useInnerText: nil)
else
expected_text = to_expected_text_values(
[expected],
true,
true,
ignoreCase
match_substring: true,
normalize_white_space: true,
ignore_case: ignoreCase,
)

expect_impl(
Expand All @@ -146,8 +146,8 @@ def to_contain_text(expected, ignoreCase: nil, timeout: nil, useInnerText: nil)
end
_define_negation :to_contain_text

def to_have_attribute(name, value, timeout: nil)
expected_text = to_expected_text_values([value])
def to_have_attribute(name, value, ignoreCase: nil, timeout: nil)
expected_text = to_expected_text_values([value], ignore_case: ignoreCase)
expect_impl(
"to.have.attribute.value",
{
Expand Down Expand Up @@ -278,9 +278,9 @@ def to_have_text(expected, ignoreCase: nil, timeout: nil, useInnerText: nil)
if expected.respond_to?(:each)
expected_text = to_expected_text_values(
expected,
true,
true,
ignoreCase,
match_substring: true,
normalize_white_space: true,
ignore_case: ignoreCase,
)
expect_impl(
"to.have.text.array",
Expand All @@ -295,9 +295,9 @@ def to_have_text(expected, ignoreCase: nil, timeout: nil, useInnerText: nil)
else
expected_text = to_expected_text_values(
[expected],
true,
true,
ignoreCase,
match_substring: true,
normalize_white_space: true,
ignore_case: ignoreCase,
)
expect_impl(
"to.have.text",
Expand Down

0 comments on commit 8a7271b

Please sign in to comment.