Skip to content

Commit

Permalink
fix: lint prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
caro3801 committed Jun 21, 2024
1 parent 5687f79 commit c00e7c4
Show file tree
Hide file tree
Showing 28 changed files with 298 additions and 963 deletions.
3 changes: 1 addition & 2 deletions .storybook/murmur_theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export default create({
barBg: '#212121',
colorPrimary: '#FF0000',
colorSecondary: '#999999',
fontBase:
'"Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
fontBase: '"Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
buttonBg: '#FF0000',
buttonColor: '#FFFFFF',
buttonBorder: '#FF0000',
Expand Down
2 changes: 1 addition & 1 deletion deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ spinner.start()
gh.publish(path.join(process.cwd(), 'dist', 'docs'), { message }, () => {
spinner.stop()
console.log(chalk.cyan(' Push complete.\n'))
});
})
3 changes: 1 addition & 2 deletions docs/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ Vue.component('SampleCard', SampleCard)

Murmur.config.set('project.name', 'Demo Project')


new Vue({
store,
render: h => h(App),
render: (h) => h(App),
router: new VueRouter({ routes })
}).$mount('#app')
4 changes: 2 additions & 2 deletions docs/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const routes = [
path: '/',
redirect: '/getting-started/installation-guide'
},
...docsFrontMatter.map(doc => {
...docsFrontMatter.map((doc) => {
const component = loadComponent(doc.meta.section, doc.name)
return { ...doc, component }
})
]

export default routes;
export default routes
6 changes: 3 additions & 3 deletions docs/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export default new Vuex.Store({
collapseMenu: true
},
mutations: {
toggleMenu (state) {
toggleMenu(state) {
state.collapseMenu = !state.collapseMenu
},
collapseMenu (state) {
collapseMenu(state) {
state.collapseMenu = true
},
showMenu (state) {
showMenu(state) {
state.collapseMenu = false
}
}
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/components/ActiveTextTruncate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ describe('ActiveTextTruncate.vue', () => {
it('shoud wrap text', () => {
const slots = { default: ['Lorem ipsum dolor sit amet.'] }
const wrapper = shallowMount(ActiveTextTruncate, { slots })
expect(
wrapper.find('.active-text-truncate__wrapper__text').exists()
).toBeTruthy()
expect(wrapper.find('.active-text-truncate__wrapper__text').exists()).toBeTruthy()
})
})
41 changes: 10 additions & 31 deletions tests/unit/components/AdvancedLinkForm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { mount, flushPromises } from '@vue/test-utils'
import AdvancedLinkForm from '@/components/AdvancedLinkForm.vue'

describe('AdvancedLinkForm.vue', () => {

const global = { stubs: { HapticCopy: true } }
it('should be a Vue instance', () => {
const wrapper = mount(AdvancedLinkForm, { global })
Expand All @@ -29,50 +28,36 @@ describe('AdvancedLinkForm.vue', () => {
}
const wrapper = mount(AdvancedLinkForm, { propsData, global })
await wrapper.vm.$nextTick()
expect(
wrapper.find('.tab-pane.active .advanced-link-form__raw__input').exists()
).toBeTruthy()
expect(wrapper.find('.advanced-link-form__raw__input').element._value).toBe(
propsData.link
)
expect(wrapper.find('.tab-pane.active .advanced-link-form__raw__input').exists()).toBeTruthy()
expect(wrapper.find('.advanced-link-form__raw__input').element._value).toBe(propsData.link)
})

it('should create switch between form using `modelValue` property', async () => {
const wrapper = mount(AdvancedLinkForm, { global })
await wrapper.vm.$nextTick()
expect(
wrapper.find('.tab-pane.active .advanced-link-form__raw').exists()
).toBeTruthy()
expect(wrapper.find('.tab-pane.active .advanced-link-form__raw').exists()).toBeTruthy()
await wrapper.setProps({ modelValue: 1 })
await flushPromises()
expect(
wrapper.find('.tab-pane.active .advanced-link-form__rich').exists()
).toBeTruthy()
expect(wrapper.find('.tab-pane.active .advanced-link-form__rich').exists()).toBeTruthy()
await wrapper.setProps({ modelValue: 2 })
await flushPromises()
expect(
wrapper.find('.tab-pane.active .advanced-link-form__markdown').exists()
).toBeTruthy()
expect(wrapper.find('.tab-pane.active .advanced-link-form__markdown').exists()).toBeTruthy()
})

it('should create only 3 forms, markdown active by default', async () => {
const propsData = { forms: ['raw', 'markdown', 'html'], modelValue: 1 }
const wrapper = mount(AdvancedLinkForm, { propsData, global })
await flushPromises()
expect(wrapper.findAll('.tab-pane').length).toBe(3)
expect(
wrapper.find('.tab-pane.active .advanced-link-form__markdown').exists()
).toBeTruthy()
expect(wrapper.find('.tab-pane.active .advanced-link-form__markdown').exists()).toBeTruthy()
})

it('should not use card by default', async () => {
const wrapper = mount(AdvancedLinkForm, { global })
await wrapper.vm.$nextTick()
expect(wrapper.classes()).not.toContain('advanced-link-form--card')
expect(wrapper.find('.nav').classes()).not.toContain('card-header-tabs')
expect(wrapper.find('.tab-pane.active').classes()).not.toContain(
'card-body'
)
expect(wrapper.find('.tab-pane.active').classes()).not.toContain('card-body')
})

it('should use card when property is set', async () => {
Expand Down Expand Up @@ -127,9 +112,7 @@ describe('AdvancedLinkForm.vue', () => {
const markdown = `[${propsData.title}](${propsData.link})`
const wrapper = mount(AdvancedLinkForm, { propsData, global })
await wrapper.vm.$nextTick()
expect(
wrapper.find('.advanced-link-form__markdown__input').element.value
).toBe(markdown)
expect(wrapper.find('.advanced-link-form__markdown__input').element.value).toBe(markdown)
})

it('should use the title in rich input', () => {
Expand All @@ -138,11 +121,7 @@ describe('AdvancedLinkForm.vue', () => {
title: 'A Great Website'
}
const wrapper = mount(AdvancedLinkForm, { propsData, global })
expect(wrapper.find('.advanced-link-form__rich__input').text()).toBe(
propsData.title
)
expect(
wrapper.find('.advanced-link-form__rich__input').attributes('href')
).toBe(propsData.link)
expect(wrapper.find('.advanced-link-form__rich__input').text()).toBe(propsData.title)
expect(wrapper.find('.advanced-link-form__rich__input').attributes('href')).toBe(propsData.link)
})
})
8 changes: 2 additions & 6 deletions tests/unit/components/DonateForm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ describe('DonateForm.vue', () => {
await wrapper.find('.frequency-monthly').trigger('click')
const amount = 3
await updateAmount(wrapper, amount)
expect(wrapper.vm.changeThe).toBe(
wrapper.vm.t('donate-form.result.conversation')
)
expect(wrapper.vm.changeThe).toBe(wrapper.vm.t('donate-form.result.conversation'))
})

it('shows a specific message for monthly amount higher or equal than 15', async () => {
Expand Down Expand Up @@ -71,9 +69,7 @@ describe('DonateForm.vue', () => {
await wrapper.find('.frequency-yearly').trigger('click')
const amount = 35
await updateAmount(wrapper, amount)
expect(wrapper.vm.changeThe).toBe(
wrapper.vm.t('donate-form.result.conversation')
)
expect(wrapper.vm.changeThe).toBe(wrapper.vm.t('donate-form.result.conversation'))
})

it('shows a specific message for yearly amount higher or equal than 180', async () => {
Expand Down
23 changes: 6 additions & 17 deletions tests/unit/components/EmbedForm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ describe('EmbedForm.vue', () => {
})

it('shows a preview panel with an iframe targeting the passed props.url without pym params', () => {
const url =
'https://projects.icij.org/the-implant-files/graphics/?initialWidth=720&childId=example-graphic'
const url = 'https://projects.icij.org/the-implant-files/graphics/?initialWidth=720&childId=example-graphic'
const wrapper = shallowMount(EmbedForm, {
propsData: { url },
global
Expand All @@ -62,9 +61,7 @@ describe('EmbedForm.vue', () => {
propsData: { height: 150, ...propsData },
global
})
const height = wrapper.element.querySelector(
'.embed-form__preview iframe'
).height
const height = wrapper.element.querySelector('.embed-form__preview iframe').height
expect(height).toBe('150')
})

Expand All @@ -73,17 +70,13 @@ describe('EmbedForm.vue', () => {
propsData: { height: 250, ...propsData },
global
})
const height = wrapper.element.querySelector(
'.embed-form__preview iframe'
).height
const height = wrapper.element.querySelector('.embed-form__preview iframe').height
expect(height).toBe('250')
})

it('renders iframe width to 100% when no value is passed to props.width', () => {
const wrapper = shallowMount(EmbedForm, { propsData, global })
const width = wrapper.element.querySelector(
'.embed-form__preview iframe'
).width
const width = wrapper.element.querySelector('.embed-form__preview iframe').width
expect(width).toBe('100%')
})

Expand All @@ -92,9 +85,7 @@ describe('EmbedForm.vue', () => {
propsData: { width: 150, ...propsData },
global
})
const width = wrapper.element.querySelector(
'.embed-form__preview iframe'
).width
const width = wrapper.element.querySelector('.embed-form__preview iframe').width
expect(width).toBe('150')
})

Expand All @@ -103,9 +94,7 @@ describe('EmbedForm.vue', () => {
propsData: { width: 250, ...propsData },
global
})
const width = wrapper.element.querySelector(
'.embed-form__preview iframe'
).width
const width = wrapper.element.querySelector('.embed-form__preview iframe').width
expect(width).toBe('250')
})

Expand Down
8 changes: 2 additions & 6 deletions tests/unit/components/GenericFooter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ describe('GenericFooter.vue', () => {

it('renders the passed props.version', () => {
const wrapper = mount(GenericFooter, { propsData })
expect(wrapper.find('.generic-footer__version').text()).toBe(
'Version 1.0.0'
)
expect(wrapper.find('.generic-footer__version').text()).toBe('Version 1.0.0')
})

it("doesn't render the version", () => {
Expand All @@ -24,8 +22,6 @@ describe('GenericFooter.vue', () => {
it('renders the current year', () => {
const wrapper = mount(GenericFooter)
const currentYear = new Date().getFullYear()
expect(wrapper.find('.generic-footer__year').text()).toBe(
String(currentYear)
)
expect(wrapper.find('.generic-footer__year').text()).toBe(String(currentYear))
})
})
12 changes: 3 additions & 9 deletions tests/unit/components/GenericHeader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ describe('GenericHeader.vue', () => {

it('renders the header as a `headroom` component', () => {
const wrapper = shallowMount(GenericHeader)
expect(wrapper.find('#generic-header').element.tagName).toBe(
'HEADROOM-STUB'
)
expect(wrapper.find('#generic-header').element.tagName).toBe('HEADROOM-STUB')
})

it('renders the header as a div', () => {
Expand All @@ -32,19 +30,15 @@ describe('GenericHeader.vue', () => {
const wrapper = shallowMount(GenericHeader, {
propsData: { position }
})
expect(wrapper.find('#generic-header').element.style.position).toBe(
position
)
expect(wrapper.find('#generic-header').element.style.position).toBe(position)
})

it('sets the header position to `absolute`', () => {
const position = 'absolute'
const wrapper = shallowMount(GenericHeader, {
propsData: { position }
})
expect(wrapper.find('#generic-header').element.style.position).toBe(
position
)
expect(wrapper.find('#generic-header').element.style.position).toBe(position)
})

it('renders home link to the default value', () => {
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/components/HapticCopy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ describe('HapticCopy.vue', () => {
label: 'Copy in the clipboard'
}
})
expect(wrapper.find('.haptic-copy__label').text()).toBe(
'Copy in the clipboard'
)
expect(wrapper.find('.haptic-copy__label').text()).toBe('Copy in the clipboard')
})

it('should emit an `success` event after copying text', async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/components/ImddbHeader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('ImddbHeader.vue', () => {
})

it("should show on mouseenter then hide popover'", async () => {
const wrapper = shallowMount(ImddbHeader,{
const wrapper = shallowMount(ImddbHeader, {
global: { renderStubDefaultSlot: true }
})

Expand Down
8 changes: 2 additions & 6 deletions tests/unit/components/OrdinalLegend.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ describe('OrdinalLegend.vue', () => {
})

it('should start with Paris', () => {
expect(wrapper.findAll('.ordinal-legend__item__label').at(0).text()).toBe(
'Paris, France'
)
expect(wrapper.findAll('.ordinal-legend__item__label').at(0).text()).toBe('Paris, France')
})

it('should end with DC', () => {
expect(wrapper.findAll('.ordinal-legend__item__label').at(2).text()).toBe(
'Washington DC, USA'
)
expect(wrapper.findAll('.ordinal-legend__item__label').at(2).text()).toBe('Washington DC, USA')
})

it('should create 3 legend items', () => {
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/components/ScaleLegend.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ describe('ScaleLegend.vue', () => {
// * values from 0 to 10,000 in white
// * values from 10,000 to 20,000 in pink
// * values from 20,000 to 30,000 in red
const colorScale = scaleThreshold()
.domain([1e4, 2e4])
.range(['white', 'pink', 'red'])
const colorScale = scaleThreshold().domain([1e4, 2e4]).range(['white', 'pink', 'red'])
// Create a scale for value between 0 and 30,000
const propsData = { min: 0, max: 3e4, width: 150, colorScale }
wrapper = shallowMount(ScaleLegend, { propsData, computed })
Expand Down
8 changes: 2 additions & 6 deletions tests/unit/components/SecretInput.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,13 @@ describe('SecretInput.vue', () => {

it('uses haptic copy button primary variant by default', () => {
const wrapper = shallowMount(SecretInput, { global })
expect(
wrapper.find('.secret-input__copy').classes('btn-primary')
).toBeTruthy()
expect(wrapper.find('.secret-input__copy').classes('btn-primary')).toBeTruthy()
})

it('changes haptic copy button variant', () => {
const propsData = { hapticCopyVariant: 'info' }
const wrapper = shallowMount(SecretInput, { global, propsData })
expect(
wrapper.find('.secret-input__copy').classes('btn-primary')
).toBeFalsy()
expect(wrapper.find('.secret-input__copy').classes('btn-primary')).toBeFalsy()
expect(wrapper.find('.secret-input__copy').classes('btn-info')).toBeTruthy()
})
})
6 changes: 1 addition & 5 deletions tests/unit/components/SelectableDropdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,7 @@ describe('SelectableDropdown.vue', () => {
it('set item as activated for multiple and items is an array of objects', () => {
const eq = (item, other) => item.label === other.label
const propsData = {
items: [
{ label: 'Lesotho' },
{ label: 'Senegal' },
{ label: 'Djibouti' }
],
items: [{ label: 'Lesotho' }, { label: 'Senegal' }, { label: 'Djibouti' }],
modelValue: [{ label: 'Lesotho' }],
multiple: true,
eq
Expand Down
Loading

0 comments on commit c00e7c4

Please sign in to comment.