-
Notifications
You must be signed in to change notification settings - Fork 35
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
2 changed files
with
82 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,60 @@ | ||
import {withLineUp, waitReady} from './utils/lineup'; | ||
import {generateData, DEFAULT_CATEGORIES} from './utils/data'; | ||
|
||
it('builder2', withLineUp((lineUpJS, document) => { | ||
const arr = generateData({ | ||
count: 10000, | ||
number: 2, | ||
cat: 1 | ||
}); | ||
cy.log('generated'); | ||
describe('builder2', () => { | ||
it('builder2', withLineUp((lineUpJS, document) => { | ||
const arr = generateData({ | ||
count: 10000, | ||
number: 2, | ||
cat: 1 | ||
}); | ||
cy.log('generated'); | ||
|
||
const desc = [{ | ||
label: 'Label', | ||
type: 'string', | ||
column: 'string' | ||
}, | ||
{ | ||
label: 'Number', | ||
type: 'number', | ||
column: 'number', | ||
domain: [0, 10] | ||
}, | ||
{ | ||
label: 'Number1', | ||
type: 'number', | ||
column: 'number1', | ||
domain: [0, 10] | ||
}, | ||
{ | ||
label: 'Cat', | ||
type: 'categorical', | ||
column: 'cat', | ||
categories: DEFAULT_CATEGORIES | ||
}, | ||
{ | ||
label: 'Date', | ||
type: 'date', | ||
column: 'date' | ||
}, | ||
]; | ||
lineUpJS.deriveColors(desc); | ||
const desc = [{ | ||
label: 'Label', | ||
type: 'string', | ||
column: 'string' | ||
}, | ||
{ | ||
label: 'Number', | ||
type: 'number', | ||
column: 'number', | ||
domain: [0, 10] | ||
}, | ||
{ | ||
label: 'Number1', | ||
type: 'number', | ||
column: 'number1', | ||
domain: [0, 10] | ||
}, | ||
{ | ||
label: 'Cat', | ||
type: 'categorical', | ||
column: 'cat', | ||
categories: DEFAULT_CATEGORIES | ||
}, | ||
{ | ||
label: 'Date', | ||
type: 'date', | ||
column: 'date' | ||
}, | ||
]; | ||
lineUpJS.deriveColors(desc); | ||
|
||
const p = new lineUpJS.LocalDataProvider(arr, desc, { | ||
// taskExecutor: 'direct', | ||
taskExecutor: 'scheduled' | ||
}); | ||
p.deriveDefault(); | ||
const p = new lineUpJS.LocalDataProvider(arr, desc, { | ||
// taskExecutor: 'direct', | ||
taskExecutor: 'scheduled' | ||
}); | ||
p.deriveDefault(); | ||
|
||
const instance = new lineUpJS.Taggle(document.body, p, { | ||
animated: false | ||
}); | ||
waitReady(instance).then(() => { | ||
expect(instance.data.getFirstRanking().getOrderLength()).to.eq(10000); | ||
expect(instance.data.getTotalNumberOfRows()).to.eq(10000); | ||
}); | ||
cy.get('.lu-stats strong').should('contain', '10,000'); | ||
cy.get('.lu-stats').should('contain', 'of 10,000 item'); | ||
})); | ||
const instance = new lineUpJS.Taggle(document.body, p, { | ||
animated: false | ||
}); | ||
waitReady(instance).then(() => { | ||
expect(instance.data.getFirstRanking().getOrderLength()).to.eq(10000); | ||
expect(instance.data.getTotalNumberOfRows()).to.eq(10000); | ||
}); | ||
cy.get('.lu-stats strong').should('contain', '10,000'); | ||
cy.get('.lu-stats').should('contain', 'of 10,000 item'); | ||
})); | ||
}); |
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,35 +1,37 @@ | ||
import {setupLineUp, waitReady} from './utils/lineup'; | ||
import {generateData, DEFAULT_CATEGORIES} from './utils/data'; | ||
|
||
it('builder2', async () => { | ||
// LineUpJS | ||
const {LineUpJS, document} = await setupLineUp(); | ||
describe('builder2', () => { | ||
it('builder2', async () => { | ||
// LineUpJS | ||
const {LineUpJS, document} = await setupLineUp(); | ||
|
||
const arr = generateData({ | ||
cat: 2 | ||
}); | ||
const builder = LineUpJS.builder(arr); | ||
const arr = generateData({ | ||
cat: 2 | ||
}); | ||
const builder = LineUpJS.builder(arr); | ||
|
||
// manually define columns | ||
builder | ||
.sidePanel(true, true) | ||
.column(LineUpJS.buildStringColumn('d').label('Label').alignment(LineUpJS.EAlignment.right).width(100)) | ||
.column(LineUpJS.buildCategoricalColumn('cat', DEFAULT_CATEGORIES).color('green')) | ||
.column(LineUpJS.buildCategoricalColumn('cat2', DEFAULT_CATEGORIES).color('blue')) | ||
.column(LineUpJS.buildNumberColumn('a', [0, 10]).color('blue')); | ||
// manually define columns | ||
builder | ||
.sidePanel(true, true) | ||
.column(LineUpJS.buildStringColumn('d').label('Label').alignment(LineUpJS.EAlignment.right).width(100)) | ||
.column(LineUpJS.buildCategoricalColumn('cat', DEFAULT_CATEGORIES).color('green')) | ||
.column(LineUpJS.buildCategoricalColumn('cat2', DEFAULT_CATEGORIES).color('blue')) | ||
.column(LineUpJS.buildNumberColumn('a', [0, 10]).color('blue')); | ||
|
||
// and two rankings | ||
const ranking = LineUpJS.buildRanking() | ||
.supportTypes() | ||
.allColumns() // add all columns | ||
.groupBy('cat') | ||
.sortBy('a', 'desc') | ||
.impose('number', 'a', 'cat2'); // create composite column | ||
// and two rankings | ||
const ranking = LineUpJS.buildRanking() | ||
.supportTypes() | ||
.allColumns() // add all columns | ||
.groupBy('cat') | ||
.sortBy('a', 'desc') | ||
.impose('number', 'a', 'cat2'); // create composite column | ||
|
||
builder | ||
.defaultRanking() | ||
.ranking(ranking); | ||
builder | ||
.defaultRanking() | ||
.ranking(ranking); | ||
|
||
const l = builder.build(document.body); | ||
waitReady(l); | ||
const l = builder.build(document.body); | ||
waitReady(l); | ||
}); | ||
}); |