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

Commitb032fd0

Browse files
authored
test: add tests for Button component (qwikifiers#40)
1 parente525f80 commitb032fd0

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import{SfIconHome}from'../SfIcons';
2+
import{SfButton}from'./SfButton';
3+
4+
it('should render content',()=>{
5+
constcontent='label';
6+
cy.mount(<SfButton>{content}</SfButton>);
7+
cy.contains(content).should('be.visible');
8+
});
9+
10+
it('should render an anchor',()=>{
11+
cy.mount(
12+
<SfButtonas="a"href="/">
13+
Link
14+
</SfButton>
15+
);
16+
cy.get('a').should('have.attr','href','/');
17+
});
18+
19+
it('should display prefix content',()=>{
20+
cy.mount(
21+
<SfButtonslotPrefix>
22+
<divq:slot="prefix"></div>
23+
Home
24+
</SfButton>
25+
);
26+
27+
cy.get('button')
28+
.invoke('text')
29+
.should((text)=>{
30+
constregex=/\s*Home/;
31+
expect(regex.test(text)).to.be.true;
32+
});
33+
});
34+
35+
it('should display suffix content',()=>{
36+
cy.mount(
37+
<SfButtonslotSuffix>
38+
<divq:slot="suffix"></div>
39+
Home
40+
</SfButton>
41+
);
42+
43+
cy.get('button')
44+
.invoke('text')
45+
.should((text)=>{
46+
constregex=/Home\s*/;
47+
expect(regex.test(text)).to.be.true;
48+
});
49+
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp