refactor: Fix linter issues on test case files
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Родитель
5bd3b5b4cf
Коммит
d75205af0a
|
@ -35,15 +35,15 @@ describe('NcHighlight.vue', () => {
|
|||
text: 'Highlight me',
|
||||
search: 'me',
|
||||
highlight: [
|
||||
{ start: 3, end: 1},
|
||||
{ start: 5, end: 7},
|
||||
]
|
||||
{ start: 3, end: 1 },
|
||||
{ start: 5, end: 7 },
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.vm.ranges).toEqual([
|
||||
{start: 1, end: 3},
|
||||
{start: 5, end: 7},
|
||||
{ start: 1, end: 3 },
|
||||
{ start: 5, end: 7 },
|
||||
])
|
||||
})
|
||||
|
||||
|
@ -57,13 +57,13 @@ describe('NcHighlight.vue', () => {
|
|||
{ start: 1, end: 3 },
|
||||
{ start: 5, end: 7 },
|
||||
{ start: 20, end: 25 },
|
||||
]
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.vm.ranges).toEqual([
|
||||
{start: 1, end: 3},
|
||||
{start: 5, end: 7},
|
||||
{ start: 1, end: 3 },
|
||||
{ start: 5, end: 7 },
|
||||
])
|
||||
})
|
||||
|
||||
|
@ -79,15 +79,15 @@ describe('NcHighlight.vue', () => {
|
|||
{ start: 5, end: 7 },
|
||||
{ start: 10, end: 25 },
|
||||
{ start: 20, end: 25 },
|
||||
]
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.vm.ranges).toEqual([
|
||||
{start: 0, end: 1},
|
||||
{start: 3, end: 3},
|
||||
{start: 5, end: 7},
|
||||
{start: 10, end: 12},
|
||||
{ start: 0, end: 1 },
|
||||
{ start: 3, end: 3 },
|
||||
{ start: 5, end: 7 },
|
||||
{ start: 10, end: 12 },
|
||||
])
|
||||
})
|
||||
|
||||
|
@ -103,15 +103,15 @@ describe('NcHighlight.vue', () => {
|
|||
{ start: 10, end: 25 },
|
||||
{ start: 5, end: 7 },
|
||||
{ start: 3, end: 3 },
|
||||
]
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.vm.ranges).toEqual([
|
||||
{start: 0, end: 1},
|
||||
{start: 3, end: 3},
|
||||
{start: 5, end: 7},
|
||||
{start: 10, end: 12},
|
||||
{ start: 0, end: 1 },
|
||||
{ start: 3, end: 3 },
|
||||
{ start: 5, end: 7 },
|
||||
{ start: 10, end: 12 },
|
||||
])
|
||||
})
|
||||
|
||||
|
@ -129,13 +129,13 @@ describe('NcHighlight.vue', () => {
|
|||
{ start: 7, end: 9 },
|
||||
{ start: 20, end: 25 },
|
||||
{ start: -10, end: -2 },
|
||||
]
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.vm.ranges).toEqual([
|
||||
{start: 0, end: 3},
|
||||
{start: 5, end: 12},
|
||||
{ start: 0, end: 3 },
|
||||
{ start: 5, end: 12 },
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -15,7 +15,7 @@ describe('Foo', () => {
|
|||
expect(wrapper.text()).toEqual('Test {placeholder}')
|
||||
})
|
||||
|
||||
it('properly inserts a child component', async() => {
|
||||
it('properly inserts a child component', async () => {
|
||||
const MyComponent = {
|
||||
name: 'MyComponent',
|
||||
render: () => {
|
||||
|
@ -27,17 +27,17 @@ describe('Foo', () => {
|
|||
text: 'Test {placeholder}',
|
||||
arguments: {
|
||||
placeholder: {
|
||||
component: MyComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
component: MyComponent,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.text()).toEqual('Test MYCOMPONENT')
|
||||
expect(wrapper.findComponent(MyComponent).exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('properly inserts a child component with props', async() => {
|
||||
it('properly inserts a child component with props', async () => {
|
||||
const MyComponent = {
|
||||
name: 'MyComponent',
|
||||
props: ['username'],
|
||||
|
@ -52,11 +52,11 @@ describe('Foo', () => {
|
|||
placeholder: {
|
||||
component: MyComponent,
|
||||
props: {
|
||||
username: 'Jane'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
username: 'Jane',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.text()).toEqual('Test MYCOMPONENT')
|
||||
|
@ -74,105 +74,105 @@ describe('Foo', () => {
|
|||
['{placeholderA}', { placeholderA: 'A', placeholderB: 'B' }, 'A'],
|
||||
['{placeholderA} {placeholderB}', { placeholderA: 'A', placeholderB: 'B' }, 'A B'],
|
||||
['Test {placeholderA} {placeholderB}', { placeholderA: 'A', placeholderB: 'B' }, 'Test A B'],
|
||||
['Test {placeholderA} {placeholderA} {placeholderB}', { placeholderA: 'A', placeholderB: 'B' }, 'Test A A B']
|
||||
['Test {placeholderA} {placeholderA} {placeholderB}', { placeholderA: 'A', placeholderB: 'B' }, 'Test A A B'],
|
||||
])('text: %s', (text, attrs, result) => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text,
|
||||
arguments: attrs
|
||||
}
|
||||
arguments: attrs,
|
||||
},
|
||||
})
|
||||
expect(wrapper.text()).toEqual(result)
|
||||
})
|
||||
|
||||
it('properly inserts a link', async() => {
|
||||
it('properly inserts a link', async () => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text: 'Testwith a link to https://example.com - go visit it',
|
||||
autolink: true
|
||||
}
|
||||
autolink: true,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.text()).toEqual('Testwith a link to https://example.com - go visit it')
|
||||
expect(wrapper.find('a').attributes('href')).toEqual('https://example.com')
|
||||
})
|
||||
|
||||
it('properly inserts a newline', async() => {
|
||||
it('properly inserts a newline', async () => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text: 'Testwith a link to https://example.com \n go visit it',
|
||||
autolink: true
|
||||
}
|
||||
autolink: true,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.text()).toEqual('Testwith a link to https://example.com \n go visit it')
|
||||
expect(wrapper.find('a').attributes('href')).toEqual('https://example.com')
|
||||
expect(wrapper.html()).toContain(`\n go visit it`)
|
||||
expect(wrapper.html()).toContain('\n go visit it')
|
||||
})
|
||||
|
||||
it('properly inserts a link with brackets', async() => {
|
||||
it('properly inserts a link with brackets', async () => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text: 'Test with a link to (https://example.com) - go visit it',
|
||||
autolink: true
|
||||
}
|
||||
autolink: true,
|
||||
},
|
||||
})
|
||||
expect(wrapper.text()).toEqual('Test with a link to (https://example.com) - go visit it')
|
||||
expect(wrapper.find('a').attributes('href')).toEqual('https://example.com')
|
||||
})
|
||||
|
||||
it('properly inserts a link containing brackets', async() => {
|
||||
it('properly inserts a link containing brackets', async () => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text: 'Test with a link to (https://example.com/Link%20(Sub)) - go visit it',
|
||||
autolink: true,
|
||||
}
|
||||
},
|
||||
})
|
||||
expect(wrapper.text()).toEqual('Test with a link to (https://example.com/Link%20(Sub)) - go visit it')
|
||||
expect(wrapper.find('a').attributes('href')).toEqual('https://example.com/Link%20(Sub)')
|
||||
})
|
||||
|
||||
it('properly inserts a link containing brackets with markdown', async() => {
|
||||
it('properly inserts a link containing brackets with markdown', async () => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text: 'Test with a link to (https://example.com/Link%20(Sub)) - go visit it',
|
||||
autolink: true,
|
||||
useMarkdown: true,
|
||||
}
|
||||
},
|
||||
})
|
||||
expect(wrapper.text()).toEqual('Test with a link to (https://example.com/Link%20(Sub)) - go visit it')
|
||||
expect(wrapper.find('a').attributes('href')).toEqual('https://example.com/Link%20(Sub)')
|
||||
})
|
||||
|
||||
it('properly recognizes an url with a custom port and inserts a link', async() => {
|
||||
it('properly recognizes an url with a custom port and inserts a link', async () => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text: 'Testwith a link to https://example.com:444 - go visit it',
|
||||
autolink: true
|
||||
}
|
||||
autolink: true,
|
||||
},
|
||||
})
|
||||
expect(wrapper.text()).toEqual('Testwith a link to https://example.com:444 - go visit it')
|
||||
expect(wrapper.find('a').attributes('href')).toEqual('https://example.com:444')
|
||||
})
|
||||
|
||||
it('properly recognizes an url with an IP address and inserts a link', async() => {
|
||||
it('properly recognizes an url with an IP address and inserts a link', async () => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text: 'Testwith a link to https://127.0.0.1/status.php - go visit it',
|
||||
autolink: true
|
||||
}
|
||||
autolink: true,
|
||||
},
|
||||
})
|
||||
expect(wrapper.text()).toEqual('Testwith a link to https://127.0.0.1/status.php - go visit it')
|
||||
expect(wrapper.find('a').attributes('href')).toEqual('https://127.0.0.1/status.php')
|
||||
})
|
||||
|
||||
it('properly formats markdown', async() => {
|
||||
it('properly formats markdown', async () => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text: '**Testwith** a link *to* [Link](https://example:1337) - go visit it',
|
||||
autolink: false,
|
||||
useMarkdown: true
|
||||
}
|
||||
useMarkdown: true,
|
||||
},
|
||||
})
|
||||
expect(wrapper.text()).toEqual('Testwith a link to Link - go visit it')
|
||||
expect(wrapper.find('a').attributes('href')).toEqual('https://example:1337')
|
||||
|
@ -180,18 +180,18 @@ describe('Foo', () => {
|
|||
expect(wrapper.find('em').text()).toEqual('to')
|
||||
})
|
||||
|
||||
it('formats markdown is disabled', async() => {
|
||||
it('formats markdown is disabled', async () => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text: '**Testwith** a ~~link~~ *to* [Link](https://example:1337) - go visit it',
|
||||
autolink: true,
|
||||
useMarkdown: false
|
||||
}
|
||||
useMarkdown: false,
|
||||
},
|
||||
})
|
||||
expect(wrapper.text()).toEqual('**Testwith** a ~~link~~ *to* [Link](https://example:1337) - go visit it')
|
||||
})
|
||||
|
||||
it('formats interactive checkbox with extended markdown', async() => {
|
||||
it('formats interactive checkbox with extended markdown', async () => {
|
||||
const wrapper = mount(NcRichText, {
|
||||
props: {
|
||||
text: '- [ ] task item',
|
||||
|
@ -200,7 +200,7 @@ describe('Foo', () => {
|
|||
},
|
||||
})
|
||||
expect(wrapper.text()).toEqual('task item')
|
||||
const checkbox = wrapper.findComponent({name: 'NcCheckboxRadioSwitch'})
|
||||
const checkbox = wrapper.findComponent({ name: 'NcCheckboxRadioSwitch' })
|
||||
expect(checkbox.exists()).toBeTruthy()
|
||||
await checkbox.vm.$emit('update:modelValue', true)
|
||||
expect(wrapper.emitted()['interact:todo']).toBeTruthy()
|
||||
|
|
|
@ -32,7 +32,7 @@ describe('FindRanges.js', () => {
|
|||
const ranges = FindRanges('ananas', 'anan')
|
||||
|
||||
expect(ranges).toEqual([
|
||||
{start: 0, end: 4},
|
||||
{ start: 0, end: 4 },
|
||||
])
|
||||
})
|
||||
|
||||
|
@ -40,16 +40,16 @@ describe('FindRanges.js', () => {
|
|||
const ranges1 = FindRanges('ananas', 'an')
|
||||
|
||||
expect(ranges1).toEqual([
|
||||
{start: 0, end: 2},
|
||||
{start: 2, end: 4},
|
||||
{ start: 0, end: 2 },
|
||||
{ start: 2, end: 4 },
|
||||
])
|
||||
|
||||
const ranges2 = FindRanges('ananas', 'a')
|
||||
|
||||
expect(ranges2).toEqual([
|
||||
{start: 0, end: 1},
|
||||
{start: 2, end: 3},
|
||||
{start: 4, end: 5},
|
||||
{ start: 0, end: 1 },
|
||||
{ start: 2, end: 3 },
|
||||
{ start: 4, end: 5 },
|
||||
])
|
||||
})
|
||||
|
||||
|
@ -57,14 +57,14 @@ describe('FindRanges.js', () => {
|
|||
const ranges1 = FindRanges('ananas', 'ana')
|
||||
|
||||
expect(ranges1).toEqual([
|
||||
{start: 0, end: 3},
|
||||
{ start: 0, end: 3 },
|
||||
])
|
||||
|
||||
const ranges2 = FindRanges('oooo', 'oo')
|
||||
|
||||
expect(ranges2).toEqual([
|
||||
{start: 0, end: 2},
|
||||
{start: 2, end: 4},
|
||||
{ start: 0, end: 2 },
|
||||
{ start: 2, end: 4 },
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче