Skip to content

Commit

Permalink
Merge pull request #50 from RedHatQE/make-pagination-backward-compatible
Browse files Browse the repository at this point in the history
Make pagination backward compatible
  • Loading branch information
LightOfHeaven1994 authored Feb 15, 2024
2 parents 5ac3aef + 4d67bc9 commit 58fa739
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
name: 🐍 Tests (python-${{ matrix.python-version }}, ${{ matrix.browser }})
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
browser: [chrome, firefox]
python-version: ["3.8", "3.9", "3.10"]
Expand Down
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]" # noqa
)

SELECTED_ITEMS_LOCATOR = (
Expand Down

0 comments on commit 58fa739

Please sign in to comment.