Skip to content

Commit

Permalink
wrap in describe blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Apr 7, 2020
1 parent c3fa18e commit 137024e
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 78 deletions.
106 changes: 54 additions & 52 deletions cypress/integration/big.spec.ts
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');
}));
});
54 changes: 28 additions & 26 deletions cypress/integration/builder2.spec.ts
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);
});
});

0 comments on commit 137024e

Please sign in to comment.