generated from Tinkoff/angular-open-source-starter
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core):
maskitoUpdateElement
should not dispatch InputEvent
if…
… value is not changed (#977)
- Loading branch information
1 parent
c67d6d5
commit 2410b64
Showing
5 changed files
with
59 additions
and
18 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
37 changes: 37 additions & 0 deletions
37
...-integrations/src/tests/component-testing/initial-calibration-plugin/dispatch-event.cy.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,37 @@ | ||
import {maskitoInitialCalibrationPlugin, MaskitoOptions} from '@maskito/core'; | ||
import {createOutputSpy} from 'cypress/angular'; | ||
|
||
import {TestInput} from '../utils'; | ||
|
||
describe('InitialCalibrationPlugin | count number of dispatched input event', () => { | ||
const maskitoOptions: MaskitoOptions = { | ||
mask: /^\d+$/, | ||
plugins: [maskitoInitialCalibrationPlugin()], | ||
}; | ||
|
||
it('Valid initial value => no dispatch of InputEvent', () => { | ||
cy.mount(TestInput, { | ||
componentProperties: { | ||
initialValue: '123', | ||
maskitoOptions, | ||
input: createOutputSpy('inputEvent'), | ||
}, | ||
}); | ||
|
||
cy.get('input').should('have.value', '123'); | ||
cy.get('@inputEvent').should('not.be.called'); | ||
}); | ||
|
||
it('Invalid initial value => dispatch of InputEvent', () => { | ||
cy.mount(TestInput, { | ||
componentProperties: { | ||
initialValue: '4abc56', | ||
maskitoOptions, | ||
input: createOutputSpy('inputEvent'), | ||
}, | ||
}); | ||
|
||
cy.get('input').should('have.value', '456'); | ||
cy.get('@inputEvent').should('have.callCount', 1); | ||
}); | ||
}); |
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