-
Notifications
You must be signed in to change notification settings - Fork 16
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 #66 from dhis2/update-select
fix(select): revisit select
- Loading branch information
Showing
8 changed files
with
237 additions
and
88 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,9 @@ | ||
Cypress.Commands.add('getAll', (...elements) => { | ||
const promise = cy.wrap([], { log: false }) | ||
|
||
for (const element of elements) { | ||
promise.then(arr => cy.get(element).then(got => cy.wrap([...arr, got]))) | ||
} | ||
|
||
return promise | ||
}) |
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
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,35 @@ | ||
import { debounce } from '../index.js' | ||
|
||
beforeEach(() => { | ||
jest.useFakeTimers() | ||
}) | ||
|
||
describe('debounce', () => { | ||
it('should call the debounced function once after the timeout without immediate', () => { | ||
const spy = jest.fn() | ||
const debounced = debounce(spy, 100) | ||
|
||
debounced() | ||
debounced() | ||
|
||
expect(spy).not.toHaveBeenCalled() | ||
|
||
jest.runAllTimers() | ||
|
||
expect(spy).toHaveBeenCalledTimes(1) | ||
}) | ||
|
||
it('should call the debounced function once immediately if immediate is set', () => { | ||
const spy = jest.fn() | ||
const debounced = debounce(spy, 100, true) | ||
|
||
debounced() | ||
debounced() | ||
|
||
expect(spy).toHaveBeenCalledTimes(1) | ||
|
||
jest.runAllTimers() | ||
|
||
expect(spy).toHaveBeenCalledTimes(1) | ||
}) | ||
}) |
Oops, something went wrong.