本文整理汇总了TypeScript中@jupyterlab/csvviewer.DSVModel类的典型用法代码示例。如果您正苦于以下问题:TypeScript DSVModel类的具体用法?TypeScript DSVModel怎么用?TypeScript DSVModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DSVModel类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('handles not having a header', () => {
const d = new DSVModel({
data: 'a,b,c\nd,e,f\n',
delimiter: ',',
header: false
});
expect(d.rowCount('column-header')).to.equal(1);
expect(d.rowCount('body')).to.equal(2);
expect(d.columnCount('row-header')).to.equal(1);
expect(d.columnCount('body')).to.equal(3);
expect([0, 1, 2].map(i => d.data('column-header', 0, i))).to.deep.equal([
'1',
'2',
'3'
]);
expect([0, 1, 2].map(i => d.data('body', 0, i))).to.deep.equal([
'a',
'b',
'c'
]);
expect([0, 1, 2].map(i => d.data('body', 1, i))).to.deep.equal([
'd',
'e',
'f'
]);
});
示例2: it
it('should instantiate a `DSVModel`', () => {
let d = new DSVModel({data: 'a,b,c\nd,e,f\n', delimiter: ','});
expect(d.rowCount('column-header')).to.be(1);
expect(d.rowCount('body')).to.be(1);
expect(d.columnCount('row-header')).to.be(1);
expect(d.columnCount('body')).to.be(3);
expect([0, 1, 2].map(i => d.data('column-header', 0, i))).to.eql(['a', 'b', 'c']);
expect([0, 1, 2].map(i => d.data('body', 0, i))).to.eql(['d', 'e', 'f']);
});
示例3: it
it('handles single non-header line', () => {
let d = new DSVModel({ data: 'a,b,c\n', delimiter: ',', header: false });
expect(d.rowCount('column-header')).to.be(1);
expect(d.rowCount('body')).to.be(1);
expect(d.columnCount('row-header')).to.be(1);
expect(d.columnCount('body')).to.be(3);
expect([0, 1, 2].map(i => d.data('column-header', 0, i))).to.eql([
'1',
'2',
'3'
]);
expect([0, 1, 2].map(i => d.data('body', 0, i))).to.eql(['a', 'b', 'c']);
});
示例4: expect
return d.ready.then(() => {
expect(d.rowCount('column-header')).to.be(1);
expect(d.rowCount('body')).to.be(3);
expect(d.columnCount('row-header')).to.be(1);
expect(d.columnCount('body')).to.be(3);
expect([0, 1, 2].map(i => d.data('column-header', 0, i))).to.eql([
'a',
'b',
'c'
]);
expect([0, 1, 2].map(i => d.data('body', 0, i))).to.eql([
'c',
'd',
'e'
]);
expect([0, 1, 2].map(i => d.data('body', 1, i))).to.eql([
'f',
'g',
'h'
]);
expect([0, 1, 2].map(i => d.data('body', 2, i))).to.eql([
'i',
'j',
'k'
]);
});