-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(VsButton): add loading state & test code (#33)
- Loading branch information
Showing
4 changed files
with
72 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
template: ` | ||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"> | ||
<path fill="currentColor" d="M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z" /> | ||
</svg>`, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/vlossom/src/components/vs-button/VsButton/__tests__/vs-button.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { mount } from '@vue/test-utils'; | ||
import VsButton from '../VsButton.vue'; | ||
|
||
describe('vs-button', () => { | ||
describe('disabled', () => { | ||
it('disabled를 설정할 수 있다.', () => { | ||
// given | ||
const wrapper = mount(VsButton, { | ||
props: { | ||
disabled: true, | ||
}, | ||
}); | ||
|
||
// then | ||
expect(wrapper.props('disabled')).toBe(true); | ||
expect(wrapper.attributes()).toHaveProperty('disabled'); | ||
}); | ||
}); | ||
|
||
describe('loading', () => { | ||
it('loading인 경우에 rotate right 아이콘이 나타난다', () => { | ||
// given | ||
const wrapper = mount(VsButton, { | ||
props: { | ||
loading: true, | ||
}, | ||
}); | ||
|
||
// then | ||
expect(wrapper.props('loading')).toBe(true); | ||
expect(wrapper.findComponent({ name: 'rotate-right' }).exists()).toBe(true); | ||
}); | ||
}); | ||
}); |