Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite525f80

Browse files
authored
test: add tests for Badge component (qwikifiers#39)
1 parent3bb336c commite525f80

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import{SfBadge}from'./SfBadge';
2+
3+
it('should render numbers',()=>{
4+
constvalue=10;
5+
cy.mount(<SfBadgecontent={value}/>);
6+
cy.contains(value).should('be.visible');
7+
});
8+
9+
it('should render 99+ if number is greater than 99',()=>{
10+
cy.mount(<SfBadgecontent={100}/>);
11+
cy.contains('99+').should('be.visible');
12+
});
13+
14+
it('should render short strings',()=>{
15+
constvalue='new';
16+
cy.mount(<SfBadgecontent={value}/>);
17+
cy.contains(value).should('be.visible');
18+
});
19+
20+
it('should render long strings',()=>{
21+
constvalue='This is a Badge';
22+
cy.mount(<SfBadgecontent={value}/>);
23+
cy.contains(value).should('be.visible');
24+
});
25+
26+
it('should apply a custom class',()=>{
27+
constclassName='example-class';
28+
cy.mount(<SfBadgecontent={100}class={className}/>);
29+
cy.get('[data-testid="badge"]').should('have.class',className);
30+
});
31+
32+
it('should hide content when variant is "dot"',()=>{
33+
constvalue=10;
34+
cy.mount(<SfBadgecontent={value}variant="dot"/>);
35+
cy.contains(value).should('not.exist');
36+
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp