Skip to content

test: update text-field tests to allow async property updates - #5524

Merged
web-padawan merged 1 commit into
mainfrom
test/text-field-async
Feb 10, 2023
Merged

web-padawan merged 1 commit into
mainfrom
test/text-field-async

Conversation

@web-padawan

Copy link
Copy Markdown
Member

Description

  1. Added nextRender() after calling fixtureSync() - this makes tests easier to debug as the element is rendered,
  2. Added nextFrame() after setting properties - this makes our unit tests forwards-compatible with LitElement.

Type of change

  • Tests

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

['disabled'].forEach((prop) => {
it(`should set boolean property ${prop}`, () => {
assertPropCanBeSet(prop, true);
it(`should set boolean property ${prop}`, async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: We could test that with snapshot tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these are there for historical reasons. We already have snapshots but they cover attributes.

['pattern', 'placeholder', 'value', 'title'].forEach((prop) => {
it(`should set string property ${prop}`, () => {
assertPropCanBeSet(prop, 'foo');
it(`should set string property ${prop}`, async () => {

@vursen vursen Feb 10, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: We could test some properties from this list with snapshot tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, let's consider replacing these with snapshots in a separate PR.

@web-padawan
web-padawan removed the request for review from tomivirkki February 10, 2023 10:41
@web-padawan
web-padawan merged commit 054024a into main Feb 10, 2023
@web-padawan
web-padawan deleted the test/text-field-async branch February 10, 2023 10:41
web-padawan added a commit that referenced this pull request Feb 10, 2023
…#5527)

Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants