-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mixed fixes - from mh's and blake's feedbacks (#509)
* Add base label, add required label, fix searchbar icon position, fix wording 'how to deploy, make required fields * make stuff rounder * Revert Canarytoken setting title, center radio input * fix padding on required * add label arrow, fix tests * remove focus from selected card
- Loading branch information
1 parent
f920627
commit 7d8eb77
Showing
40 changed files
with
303 additions
and
111 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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,14 @@ | ||
import { mount } from '@vue/test-utils'; | ||
import BaseLabel from './BaseLabel.vue'; | ||
|
||
describe('BaseLabel.vue', () => { | ||
it('shows asterisk when required', () => { | ||
const modelValue = 'initialText'; | ||
const id = 'custom id'; | ||
|
||
const wrapper = mount(BaseLabel, { | ||
props: { label: 'Required Field', required: true, modelValue, id }, | ||
}); | ||
expect(wrapper.html()).toContain('<span class="text-green-500"> *</span>'); | ||
}); | ||
}); |
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,21 @@ | ||
<template> | ||
<label | ||
:for="id" | ||
class="mb-4 ml-4 font-semibold" | ||
> | ||
<slot></slot> | ||
<span | ||
v-if="required" | ||
class="text-green-500" | ||
> | ||
*</span | ||
></label | ||
> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
defineProps<{ | ||
id: string; | ||
required?: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { mount, shallowMount } from '@vue/test-utils'; | ||
import { ref } from 'vue'; | ||
import BaseFormTextField from '@/components/base/BaseFormTextField.vue'; | ||
import BaseLabelArrow from './BaseLabelArrow.vue'; | ||
import BaseLabel from './BaseLabel.vue'; | ||
|
||
describe('BaseLabelArrow.vue', () => { | ||
it('renders label when passed', () => { | ||
const label = 'Test Label'; | ||
const modelValue = 'initialText'; | ||
const id = 'custom_id'; | ||
|
||
const wrapper = mount(BaseLabelArrow, { | ||
props: { label, modelValue, id }, | ||
}); | ||
expect(wrapper.text()).toMatch(label); | ||
}); | ||
|
||
it('adds arrow class to the specified word in the label', () => { | ||
const arrowWordPosition = 2; | ||
const label = ref('Test Label Here'); | ||
const arrowVariant = ref('one'); | ||
|
||
const wrapper = shallowMount(BaseLabelArrow, { | ||
//@ts-ignore | ||
props: { arrowWordPosition, label, arrowVariant }, | ||
}); | ||
|
||
//@ts-ignore | ||
const labelArrowed = wrapper.vm.labelArrowed; | ||
|
||
const expectedOutput = | ||
'Test <span class="label-arrow label-arrow__one" alt="arrow">Label</span> Here'; | ||
|
||
expect(labelArrowed).toBe(expectedOutput); | ||
}); | ||
|
||
it('should not add arrow if no position is provided', () => { | ||
const label = ref('Test Label Here'); | ||
const arrowVariant = ref('one'); | ||
|
||
const wrapper = shallowMount(BaseLabelArrow, { | ||
//@ts-ignore | ||
props: { label, arrowVariant }, | ||
}); | ||
|
||
//@ts-ignore | ||
const labelArrowed = wrapper.vm.labelArrowed; | ||
|
||
expect(labelArrowed).toBe('Test Label Here'); | ||
}); | ||
}); |
Oops, something went wrong.