This repository has been archived by the owner on Nov 26, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
191 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import childRow from './setup/ChildRow.vue'; | ||
|
||
describe(suite + ': Child row', () => { | ||
|
||
var firstRowToggler = 'table tbody tr td:first-child span'; | ||
|
||
beforeEach(()=>{ | ||
|
||
setOptions({ | ||
childRow | ||
}); | ||
|
||
}); | ||
|
||
it('generates a child row when toggler is clicked, and removes it when clicked again', (done) =>{ | ||
|
||
click(firstRowToggler); | ||
|
||
run(function() { | ||
see('My Child Row ZW','table tbody tr:nth-child(2)'); | ||
click(firstRowToggler); | ||
see('Zambia','table tbody tr:nth-child(2)'); | ||
},done); | ||
|
||
}); | ||
|
||
it('only opens the clicked row', (done) => { | ||
|
||
click(firstRowToggler); | ||
|
||
run(function() { | ||
count('.VueTables__child-row',1); | ||
},done); | ||
|
||
}); | ||
|
||
it('displays the correct toggler icon', (done) => { | ||
run(function() { | ||
count('.VueTables__child-row-toggler--closed', 10); | ||
click(firstRowToggler); | ||
count('.VueTables__child-row-toggler--closed', 9); | ||
exists('table tbody tr:first-child .VueTables__child-row-toggler--open'); | ||
},done); | ||
}); | ||
|
||
|
||
}); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,19 +1,97 @@ | ||
describe('Server: Request', () => { | ||
|
||
var initialParams = { | ||
query: '', | ||
limit: 10, | ||
ascending: 1, | ||
page: 1, | ||
byColumn: 0 | ||
}; | ||
|
||
it('sends a request when initialized to the URL defined by the consumer with the right parameters', ()=>{ | ||
|
||
var request = moxios.requests.mostRecent(); | ||
|
||
expect(request.config.url).toEqual(vm().url); | ||
|
||
expect(request.config.params).toEqual( | ||
{ | ||
query: '', | ||
limit: 10, | ||
ascending: 1, | ||
page: 1, | ||
byColumn: 0 | ||
}); | ||
expect(request.config.params).toEqual(initialParams); | ||
|
||
// orderBy is not sent by default, unless the consumer defined a column to sort by using the orderBy option | ||
|
||
}); | ||
|
||
it('Allows for modifying the request keys', (done) => { | ||
|
||
setOptions({ | ||
requestKeys:{ | ||
query:'filter', | ||
limit:'perPage' | ||
} | ||
}); | ||
|
||
vm().getData(true).then(()=>{ | ||
|
||
done(); | ||
|
||
var request = moxios.requests.mostRecent(); | ||
|
||
expect(request.config.params).toEqual( | ||
{ | ||
filter: '', | ||
perPage: 10, | ||
ascending: 1, | ||
page: 1, | ||
byColumn: 0 | ||
}); | ||
}); | ||
|
||
|
||
}); | ||
|
||
it('can use a custom request function', (done)=>{ | ||
|
||
var response = {data:[],count:0}; | ||
|
||
setOptions({ | ||
requestFunction(data) { | ||
return new Promise(function(resolve, reject) { | ||
|
||
setTimeout(()=>{ | ||
resolve(response); | ||
done(); | ||
},100); | ||
|
||
}); | ||
} | ||
}); | ||
|
||
|
||
vm().getData(true).then((res)=>{ | ||
expect(res).toEqual(response); | ||
}); | ||
|
||
}); | ||
|
||
it('can use a request adapter', (done)=>{ | ||
|
||
|
||
setOptions({ | ||
requestAdapter(data) { | ||
return {data}; | ||
} | ||
}); | ||
|
||
vm().getData(true).then(()=>{ | ||
|
||
done(); | ||
|
||
var request = moxios.requests.mostRecent(); | ||
|
||
expect(request.config.params).toEqual({data:initialParams}); | ||
|
||
}); | ||
|
||
|
||
}); | ||
|
||
}); |
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,11 @@ | ||
<template> | ||
<div> | ||
My Child Row {{data.code}} | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props:['data'] | ||
} | ||
</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,23 @@ | ||
|
||
import Vue from 'vue' | ||
import { mount } from 'vue-test-utils' | ||
import ClientTable from '../../compiled/v-client-table' | ||
import data from './example-data' | ||
|
||
global.suite = 'Client'; | ||
|
||
global.run = function(cb, done) { | ||
cb(); | ||
done(); | ||
} | ||
|
||
beforeEach(function() { | ||
global.wrapper = mount(ClientTable.install(Vue), { | ||
propsData:{ | ||
columns:['code','name','uri'], | ||
data, | ||
options:{} | ||
} | ||
}); | ||
}); | ||
|
File renamed without changes.
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