-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96d9c93
commit 54cbfcf
Showing
11 changed files
with
166 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
change/@fluentui-eslint-plugin-b9154030-4181-4675-b110-63c62d547695.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Add ./e2e to list of files allowing devDependencies", | ||
"packageName": "@fluentui/eslint-plugin", | ||
"email": "[email protected]", | ||
"dependentChangeType": "none" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-01f47d41-d589-464a-ada7-4ae8b9d47604.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "none", | ||
"comment": "Add command to run e2e tests", | ||
"packageName": "@fluentui/react", | ||
"email": "[email protected]", | ||
"dependentChangeType": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// workaround for https://github.com/cypress-io/cypress/issues/8599 | ||
import '@fluentui/scripts/cypress/support'; |
47 changes: 47 additions & 0 deletions
47
...-examples/src/react/FocusTrapZone/e2e/FocusTrapZone.TabWrappingMultiFocusZone.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as React from 'react'; | ||
import { FocusZone, FocusTrapZone, FocusZoneDirection, mergeStyles } from '@fluentui/react'; | ||
|
||
const rootClass = mergeStyles({ | ||
position: 'relative', | ||
button: { position: 'absolute', height: 30, width: 30 }, | ||
'#a': { top: 0, left: 0 }, | ||
'#b': { top: 0, left: 30 }, | ||
'#c': { top: 0, left: 60 }, | ||
'#d': { top: 30, left: 0 }, | ||
'#e': { top: 30, left: 30 }, | ||
'#f': { top: 30, left: 60 }, | ||
}); | ||
|
||
/** | ||
* Tab and shift-tab wrap at extreme ends of the FTZ: | ||
* | ||
* can tab across FocusZones with different button structures | ||
*/ | ||
export const TabWrappingMultiFocusZone = () => { | ||
return ( | ||
<div className={rootClass}> | ||
<FocusTrapZone forceFocusInsideTrap={false}> | ||
<FocusZone direction={FocusZoneDirection.horizontal}> | ||
<div> | ||
<button id="a">a</button> | ||
</div> | ||
<div> | ||
<button id="b">b</button> | ||
</div> | ||
<div> | ||
<button id="c">c</button> | ||
</div> | ||
</FocusZone> | ||
<FocusZone direction={FocusZoneDirection.horizontal}> | ||
<div> | ||
<div> | ||
<button id="d">d</button> | ||
<button id="e">e</button> | ||
<button id="f">f</button> | ||
</div> | ||
</div> | ||
</FocusZone> | ||
</FocusTrapZone> | ||
</div> | ||
); | ||
}; |
63 changes: 63 additions & 0 deletions
63
packages/react-examples/src/react/FocusTrapZone/e2e/FocusTrapZone.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const ftzStoriesTitle = 'Components/FocusTrapZone/e2e'; | ||
|
||
describe('FocusTrapZone', () => { | ||
before(() => { | ||
cy.visitStorybook({ qs: { e2e: '1' } }); | ||
}); | ||
|
||
describe('Tab and shift-tab wrap at extreme ends of the FTZ', () => { | ||
it('can tab across FocusZones with different button structures', () => { | ||
cy.loadStory(ftzStoriesTitle, 'TabWrappingMultiFocusZone'); | ||
|
||
cy.get('#a').focus(); | ||
cy.focused().should('have.id', 'a'); | ||
|
||
// shift+tab to focus first bumper | ||
cy.realPress(['Shift', 'Tab']); | ||
cy.focused().should('have.id', 'd'); | ||
|
||
// tab to focus last bumper | ||
cy.realPress('Tab'); | ||
cy.focused().should('have.id', 'a'); | ||
}); | ||
|
||
it('can tab across a FocusZone with different button structures', () => { | ||
cy.loadStory(ftzStoriesTitle, 'TabWrappingFocusZone'); | ||
|
||
cy.get('#x').focus(); | ||
cy.focused().should('have.id', 'x'); | ||
|
||
// shift+tab to focus first bumper | ||
cy.realPress(['Shift', 'Tab']); | ||
cy.focused().should('have.id', 'a'); | ||
|
||
// tab to focus last bumper | ||
cy.realPress('Tab'); | ||
cy.focused().should('have.id', 'x'); | ||
}); | ||
|
||
it( | ||
'can trap focus when FTZ bookmark elements are FocusZones, ' + | ||
'and those elements have inner elements focused that are not the first inner element', | ||
() => { | ||
cy.loadStory(ftzStoriesTitle, 'TabWrappingFocusZoneBumpers'); | ||
|
||
// Focus the middle button in the first FZ. | ||
cy.get('#a').focus().realPress('ArrowRight'); | ||
cy.focused().should('have.id', 'b'); | ||
|
||
// Focus the middle button in the second FZ. | ||
cy.get('#e').focus().realPress('ArrowRight'); | ||
cy.focused().should('have.id', 'f'); | ||
|
||
// tab to focus last bumper | ||
cy.realPress('Tab'); | ||
cy.focused().should('have.id', 'b'); | ||
|
||
// shift+tab to focus first bumper | ||
cy.realPress(['Shift', 'Tab']); | ||
cy.focused().should('have.id', 'f'); | ||
}, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters