-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core):
Textfield
with initial value has change detection proble…
…ms with `filler` (#9375)
- Loading branch information
1 parent
b20f6bf
commit 8217c90
Showing
3 changed files
with
84 additions
and
6 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,73 @@ | ||
import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {TUI_ANIMATIONS_SPEED, TuiRoot, TuiTextfield} from '@taiga-ui/core'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [FormsModule, TuiRoot, TuiTextfield], | ||
template: ` | ||
<tui-root> | ||
<tui-textfield [filler]="filler"> | ||
<input | ||
tuiTextfield | ||
[(ngModel)]="initialValue" | ||
/> | ||
</tui-textfield> | ||
</tui-root> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
providers: [{provide: TUI_ANIMATIONS_SPEED, useValue: 0}], | ||
}) | ||
export class TestTextfield { | ||
@Input() | ||
public initialValue = ''; | ||
|
||
@Input() | ||
public filler = ''; | ||
} | ||
|
||
describe('Textfield', () => { | ||
describe('[filler] property', () => { | ||
beforeEach(() => cy.viewport(200, 150)); | ||
|
||
describe('with initial value', () => { | ||
['2', '23', '23:', '23:5', '23:59'].forEach((initialValue) => { | ||
it(initialValue, () => { | ||
cy.mount(TestTextfield, { | ||
componentProperties: { | ||
initialValue, | ||
filler: 'HH:MM', | ||
}, | ||
}); | ||
|
||
cy.get('input[tuiTextfield]').focus(); | ||
cy.get('tui-textfield').compareSnapshot( | ||
`[filler]-initial-value_${initialValue}`, | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('user types new value', () => { | ||
beforeEach(() => { | ||
cy.mount(TestTextfield, { | ||
componentProperties: { | ||
filler: 'HH:MM', | ||
}, | ||
}); | ||
|
||
cy.get('input[tuiTextfield]').focus(); | ||
}); | ||
|
||
['2', '23', '23:', '23:5', '23:59'].forEach((value) => { | ||
it(value, () => { | ||
cy.get('input[tuiTextfield]').type(value); | ||
|
||
cy.get('tui-textfield').compareSnapshot( | ||
`[filler]-user-types_${value}`, | ||
); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |