-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(home): separate home text cursor to a separate component, add Ta…
…ilwind and tests (#398)
- Loading branch information
1 parent
268c76e
commit 21d5e4c
Showing
5 changed files
with
72 additions
and
45 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { VueWrapper } from '@vue/test-utils'; | ||
import { buildCreateWrapper, getTestingSelector } from '@/utils/test'; | ||
import HomeTextCursor from '@/components/main/home/HomeTextCursor.vue'; | ||
|
||
const CURSOR_SELECTOR = getTestingSelector('cursor'); | ||
|
||
const createWrapper = buildCreateWrapper(HomeTextCursor); | ||
|
||
describe('HomeTextCursor', () => { | ||
function getCursorElement(wrapper: VueWrapper) { | ||
return wrapper.get<HTMLSpanElement>(CURSOR_SELECTOR); | ||
} | ||
|
||
it("blinks by the 'blinking' property", async () => { | ||
const wrapper = createWrapper({ | ||
blinking: false, | ||
}); | ||
|
||
expect(getCursorElement(wrapper).classes('animate-blinking')).toBe(false); | ||
|
||
await wrapper.setProps({ blinking: true }); | ||
|
||
expect(getCursorElement(wrapper).classes('animate-blinking')).toBe(true); | ||
}); | ||
}); |
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,13 @@ | ||
<template> | ||
<span | ||
data-testid="cursor" | ||
class="animate-wiggle bg-current h-[1.2em] inline-flex w-0.5" | ||
:class="{ 'animate-blinking': blinking }" | ||
/> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
defineProps<{ | ||
blinking: boolean; | ||
}>(); | ||
</script> |
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