Skip to content

Commit

Permalink
Make pagination backward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
LightOfHeaven1994 committed Feb 8, 2024
1 parent 5ac3aef commit f8accdc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/widgetastic_patternfly5/components/menus/dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ def _verify_enabled(self):
@property
def is_open(self):
"""Returns True if the Dropdown is open"""
return "pf-m-expanded" in self.browser.classes(
self.BUTTON_LOCATOR
) or "pf-m-expanded" in self.browser.classes(self)
return (
"pf-m-expanded" in self.browser.classes(self.BUTTON_LOCATOR)
or "pf-m-expanded" in self.browser.classes(self)
or self.browser.attributes(self.BUTTON_LOCATOR).get("aria-expanded") == "true"
)

def open(self):
"""Opens a dropdown."""
Expand Down
5 changes: 3 additions & 2 deletions src/widgetastic_patternfly5/components/menus/options_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ class BaseOptionsMenu:
TEXT_LOCATOR = (
'.//div[contains(@class, "-c-options-menu") and child::button[normalize-space(.)={}]]'
)
# PF4/5 backward compatibility locator
DEFAULT_LOCATOR = (
"(.//button[contains(@class, '-c-menu-toggle') or "
"contains(@class, '-c-options-menu')]/parent::div)[1]"
".//div[contains(@data-ouia-component-type, 'PaginationOptionsMenu')] | "
"(.//button[contains(@class, '-c-menu-toggle') or contains(@class, '-c-options-menu')]/parent::div)[1]"
)

SELECTED_ITEMS_LOCATOR = (
Expand Down

0 comments on commit f8accdc

Please sign in to comment.