本文整理匯總了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'
]);
});