-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avatar unit tests #28800
avatar unit tests #28800
Conversation
…erbrady/fluentui-fork into web-components-v3
🕵 fluentui-web-components-v3 No visual regressions between this PR and main |
📊 Bundle size report🤖 This report was generated against c96ab181996ff35afdf4e0a4dbd05d4954beba59 |
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: c96ab181996ff35afdf4e0a4dbd05d4954beba59 (build) |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b5a5617:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to get a bit more robust on the tests here.
test('should render with custom initials based on the provided initials value', async () => { | ||
await root.evaluate(node => { | ||
node.innerHTML = /* html */ ` | ||
<fluent-avatar initials="JD"></fluent-avatar> | ||
`; | ||
}); | ||
|
||
await expect(element).toHaveText('JD'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this actually fully tests what we'd like to see. This does provide initials when initials are provided, but I think we should validate that something like a name of Julie Wright
with custom initials provided of JJ
would yeild, JJ
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both are probably worthwile but we should be specific, "When no name value is set" for the first, "When name value is set" for the second.
test('should set the size attribute to the provided size value', async () => { | ||
await root.evaluate(node => { | ||
node.innerHTML = /* html */ ` | ||
<fluent-avatar size="48"></fluent-avatar> | ||
`; | ||
}); | ||
|
||
await expect(element).toHaveAttribute('size', '48'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we test all? What about when size is updated, etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the below tests
|
||
await expect(element).toHaveAttribute('color', 'brand'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about active
, using colorId
, the this.color
colorful portion (should that be tested for input/output)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was having a heck of a time testing the color-id scenarios. Let me know what you think.
…rianbrady/avatarUnitTests
2c97f92
into
microsoft:web-components-v3
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
* radio init * styles radio * reverts branch * input spec init * cleans up spec * formatting * updates component name to text input * updates component name in spec * reverts dead file * avatar unit tests: adds tests * avatar tests: updates tests * avatar unit tests: updates tests * fix lint errors * fixes linting errors --------- Co-authored-by: Miroslav Stastny <miroslav.stastny@microsoft.com>
Adds Avatar unit tests