only in patch2: unchanged: --- /dev/null +++ b/core/profiles/demo_umami/tests/src/FunctionalJavascript/DemoUmamiMainMenuTest.php @@ -0,0 +1,79 @@ +getSession()->resizeWindow(400, 700); + + $assert = $this->assertSession(); + + $this->drupalGet(''); + + // @todo remove screenshot + $this->createScreenshot('umamu2.jpg'); + + // @todo remove trivial assert, this is just to get me started + $assert->pageTextContains('pasta'); + + // Various checks to confirm the menu behaviour is initialized correctly. + // assert button is visible + $button = $assert->elementExists('css', '.menu-main-toggle'); + $assert->assert($button->isVisible(), 'Menu button is not visible.'); + + //assert button is labelled - can we test the *computed accessible name*? + // workaround is to test for aria-label="foo", but that's an implementation detail, rather than the desiered end itself... + + //assert button has aria-controls + + //assert button has aria-expanded, initialized to false + $assert->assert($button->getAttribute('aria-expanded') === 'false', 'aria-expanded attribute not initialized correctly.'); + + //assert menu UL is collapsed (class) - do we actually need to test that? It's a implementation detail, not a behaviour... + //assert menu links (home, articles, recipes) are NOT visible - this is the actual behaviour + // assert button is focusable? + + // interaction behaviour, open it + // WORLD - THE TIME HAS COME TO PUSH THE BUTTON + // assert button now says aria-expanded=true + // assert button still has focus + // assert menu UL has expanded class (maybe) + // assert menu links are visible + + // interaction behaviour, close it + // WORLD - THE TIME HAS COME TO PUSH THE BUTTON + // assert button now says aria-expanded=false + // assert button still has focus + // assert menu UL is collapsed (maybe) + // assert menu links are NOT visible + + // @TODO same as previous test, but do it with SPACEBAR. + + // @TODO do we need to run tests for "click", separate to keypress? + + // @todo resize window, wide viewport + // no button visible, links visible. + } + +}