Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from fkhadra/next
v6.0.0
- Loading branch information
Showing
53 changed files
with
3,634 additions
and
12,102 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
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,14 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
projectId: 'fwfrp4', | ||
e2e: { | ||
// We've imported your old cypress plugins here. | ||
// You may want to clean this up later by importing these. | ||
setupNodeEvents(on, config) { | ||
return require('./cypress/plugins/index.js')(on, config) | ||
}, | ||
baseUrl: 'http://localhost:1234', | ||
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', | ||
}, | ||
}) |
This file was deleted.
Oops, something went wrong.
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,92 @@ | ||
import { DATA_TEST } from '../../example/constants'; | ||
|
||
describe('Context menu keyboard interaction', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
}); | ||
|
||
it('Select first menu item when pressing arrow down', () => { | ||
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick(); | ||
cy.get('body').type('{downarrow}'); | ||
|
||
cy.focused().should('have.attr', 'data-test', DATA_TEST.MENU_FIRST_ITEM); | ||
}); | ||
|
||
it('Select the last item when pressing arrow up', () => { | ||
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick(); | ||
cy.get('body').type('{uparrow}'); | ||
|
||
cy.focused().should('have.attr', 'data-test', DATA_TEST.MENU_LAST_ITEM); | ||
}); | ||
|
||
it('Should not select disabled items', () => { | ||
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick(); | ||
|
||
//🙅♀️ go to item 4 and skip disabled items | ||
for (let i = 0; i < 4; i++) { | ||
cy.get('body').type('{downarrow}'); | ||
cy.focused().should('have.attr', 'aria-disabled', 'false'); | ||
} | ||
}); | ||
|
||
describe('Open submenu and focus first item', () => { | ||
for (const key of ['{enter}', ' ', '{rightarrow}']) { | ||
it(`When ${key} is pressed`, () => { | ||
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick(); | ||
|
||
//🙅♀️ go to submenu | ||
cy.get('body').type('{uparrow}'); | ||
cy.get('body').type('{uparrow}'); | ||
|
||
cy.focused().should('have.attr', 'data-test', DATA_TEST.SUBMENU); | ||
|
||
cy.getByDataTest(DATA_TEST.SUBMENU_FIRST_ITEM).should('not.be.visible'); | ||
cy.get('body').type(key); | ||
|
||
// wait for transition | ||
cy.wait(500); | ||
cy.focused().should( | ||
'have.attr', | ||
'data-test', | ||
DATA_TEST.SUBMENU_FIRST_ITEM | ||
); | ||
}); | ||
} | ||
}); | ||
|
||
it('Close submenu on left arrow press', () => { | ||
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick(); | ||
|
||
//🙅♀️ go to submenu | ||
cy.get('body').type('{uparrow}'); | ||
cy.get('body').type('{uparrow}'); | ||
|
||
cy.get('body').type('{rightarrow}'); | ||
|
||
// wait for transition | ||
cy.wait(500); | ||
cy.focused().should('have.attr', 'data-test', DATA_TEST.SUBMENU_FIRST_ITEM); | ||
|
||
cy.get('body').type('{leftarrow}'); | ||
cy.focused().should('have.attr', 'data-test', DATA_TEST.SUBMENU); | ||
}); | ||
|
||
it('Should handle keyboard shortcut', () => { | ||
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick(); | ||
|
||
cy.get('body').type('{ctrl}{u}'); | ||
cy.wait(500); | ||
cy.getByDataTest(DATA_TEST.KDB_SHORTCUT).then((el) => { | ||
expect(el.text()).eq('ctrl+u'); | ||
}); | ||
|
||
// nested shortcut | ||
cy.getByDataTest(DATA_TEST.CONTEXT_MENU_TRIGGER).rightclick(); | ||
|
||
cy.get('body').type('{ctrl}{s}'); | ||
cy.wait(500); | ||
cy.getByDataTest(DATA_TEST.KDB_SHORTCUT).then((el) => { | ||
expect(el.text()).eq('ctrl+s'); | ||
}); | ||
}); | ||
}); |
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,11 @@ | ||
export const animation = { | ||
fade: 'fade', | ||
flip: 'flip', | ||
scale: 'scale', | ||
slide: 'slide', | ||
}; | ||
|
||
export const theme = { | ||
light: 'light', | ||
dark: 'dark', | ||
}; |
Oops, something went wrong.