Skip to content

Commit

Permalink
Rename files and fix first Item padding
Browse files Browse the repository at this point in the history
  • Loading branch information
zysim committed May 5, 2024
1 parent e7fdb2a commit accd1db
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
15 changes: 8 additions & 7 deletions components/blocks/LeaderboardInfo/Desktop/Desktop.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import ButtonLink from 'elements/buttons/ButtonLink/ButtonLink.vue'

Check failure on line 2 in components/blocks/LeaderboardInfo/Desktop/Desktop.vue

View workflow job for this annotation

GitHub Actions / build_and_lint

`elements/buttons/ButtonLink/ButtonLink.vue` import should occur after import of `elements/buttons/Dropdown/DropdownItem.vue`
import DropDown from 'elements/buttons/DropDown/DropDown.vue'
import DropDownItem from 'elements/buttons/DropDown/DropDownItem.vue'
import Dropdown from 'elements/buttons/Dropdown/Dropdown.vue'
import DropdownItem from 'elements/buttons/Dropdown/DropdownItem.vue'
import FollowButton from 'elements/buttons/FollowButton/FollowButton.vue'
import SocialButtons from 'elements/buttons/SocialButtons/SocialButtons.vue'
import Tag from 'elements/tags/Tag/Tag.vue'
Expand Down Expand Up @@ -68,11 +68,11 @@ defineProps<Props>()
<i-svg-link />
<div>Resources</div>
</ButtonLink>
<DropDown class-name="body__internal-link-buttons__button">
<DropDownItem>First</DropDownItem>
<DropDownItem>Second</DropDownItem>
<DropDownItem>Third</DropDownItem>
</DropDown>
<Dropdown class-name="body__internal-link-buttons__button">
<DropdownItem>First</DropdownItem>
<DropdownItem>Second</DropdownItem>
<DropdownItem>Third</DropdownItem>
</Dropdown>
</div>
<SocialButtons :socials="socials" />
</div>
Expand Down Expand Up @@ -131,3 +131,4 @@ defineProps<Props>()
}
}
</style>
elements/buttons/Dropdown/Dropdown.vueelements/buttons/Dropdown/DropdownItem.vue
18 changes: 9 additions & 9 deletions components/elements/buttons/DropDown/DropDown.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { enableAutoUnmount, mount } from '@vue/test-utils'
import { getByTestId } from 'root/testUtils'
import DropDown from './DropDown.vue'
import DropDownItem from './DropDownItem.vue'
import Dropdown from './Dropdown.vue'
import DropdownItem from './DropdownItem.vue'
import type { ComponentMountingOptions } from '@vue/test-utils'

enableAutoUnmount(afterEach)

function mountDropDown(options?: ComponentMountingOptions<typeof DropDown>) {
return mount(DropDown, options)
function mountDropdown(options?: ComponentMountingOptions<typeof Dropdown>) {
return mount(Dropdown, options)
}

describe('<DropDown />', () => {
describe('<Dropdown />', () => {
it('should render without crashing', () => {
const wrapper = mountDropDown({
const wrapper = mountDropdown({
props: { className: 'test' },
})
expect(wrapper.isVisible()).toBe(true)
Expand All @@ -21,9 +21,9 @@ describe('<DropDown />', () => {

describe('when the toggler is clicked', () => {
it('should render the slot item, then hide it on a second click', async () => {
const itemWrapper = mount(DropDownItem)
const itemWrapper = mount(DropdownItem)

const wrapper = mountDropDown({
const wrapper = mountDropdown({
slots: { default: itemWrapper.html() },
})

Expand All @@ -35,7 +35,7 @@ describe('<DropDown />', () => {
})

it('should apply the style to the dropdown arrow', async () => {
const wrapper = mountDropDown()
const wrapper = mountDropdown()

await getByTestId(wrapper, 'toggler').trigger('click')

Expand Down
8 changes: 4 additions & 4 deletions components/elements/buttons/DropDown/DropDownItem.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { enableAutoUnmount, shallowMount } from '@vue/test-utils'
import { getByTestId } from 'root/testUtils'
import DropDownItem from './DropDownItem.vue'
import DropdownItem from './DropdownItem.vue'
import type { ComponentMountingOptions } from '@vue/test-utils'

enableAutoUnmount(afterEach)

function mountDropDownItem(
options?: ComponentMountingOptions<typeof DropDownItem>,
options?: ComponentMountingOptions<typeof DropdownItem>,
) {
return shallowMount(DropDownItem, options)
return shallowMount(DropdownItem, options)
}

describe('<DropDownItem />', () => {
describe('<DropdownItem />', () => {
it('should render without crashing', () => {
const wrapper = mountDropDownItem({
props: { slots: 'test' },
Expand Down
6 changes: 3 additions & 3 deletions components/elements/buttons/DropDown/DropDownItem.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { inject, ref } from 'vue'
import type { SharedState } from './DropDown.vue'
import type { SharedState } from './Dropdown.vue'
const emit = defineEmits<{
(event: 'click'): void
Expand All @@ -24,8 +24,8 @@ function hide() {
.container {
@apply py-2 text-center border border-t-0 border-gray-200 hover:bg-gray-100;
&:first {
@apply pt-4;
&:first-child {
@apply pt-3;
}
}
</style>

0 comments on commit accd1db

Please sign in to comment.