Skip to content
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

Conversation

brianchristopherbrady
Copy link
Contributor

Adds Avatar unit tests

@brianchristopherbrady brianchristopherbrady requested a review from a team as a code owner August 9, 2023 22:01
@fabricteam
Copy link
Collaborator

fabricteam commented Aug 9, 2023

🕵 fluentui-web-components-v3 No visual regressions between this PR and main

@fabricteam
Copy link
Collaborator

fabricteam commented Aug 9, 2023

📊 Bundle size report

🤖 This report was generated against c96ab181996ff35afdf4e0a4dbd05d4954beba59

@size-auditor
Copy link

size-auditor bot commented Aug 9, 2023

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: c96ab181996ff35afdf4e0a4dbd05d4954beba59 (build)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 9, 2023

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:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

Copy link
Member

@chrisdholt chrisdholt left a 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.

Comment on lines 38 to 46
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');
});
Copy link
Member

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.

Copy link
Member

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.

Comment on lines 48 to 56
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');
});
Copy link
Member

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?

Copy link
Member

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');
});
});
Copy link
Member

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)?

Copy link
Contributor Author

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.

@miroslavstastny miroslavstastny merged commit 2c97f92 into microsoft:web-components-v3 Aug 24, 2023
19 checks passed
chrisdholt pushed a commit that referenced this pull request Apr 29, 2024
* 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>
radium-v pushed a commit to radium-v/fluentui that referenced this pull request Apr 29, 2024
* 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>
radium-v pushed a commit to radium-v/fluentui that referenced this pull request Apr 29, 2024
* 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>
radium-v pushed a commit to radium-v/fluentui that referenced this pull request Apr 30, 2024
* 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>
radium-v pushed a commit that referenced this pull request Apr 30, 2024
* 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>
radium-v pushed a commit that referenced this pull request May 2, 2024
* 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>
radium-v pushed a commit that referenced this pull request May 2, 2024
* 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>
radium-v pushed a commit that referenced this pull request May 2, 2024
* 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>
radium-v pushed a commit that referenced this pull request May 3, 2024
* 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>
radium-v pushed a commit that referenced this pull request May 6, 2024
* 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>
radium-v pushed a commit that referenced this pull request May 6, 2024
* 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>
radium-v pushed a commit that referenced this pull request May 8, 2024
* 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>
radium-v pushed a commit that referenced this pull request May 10, 2024
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants