diff --git a/addon/components/hyper-table-v2/column.ts b/addon/components/hyper-table-v2/column.ts index 660ffe1d..04de7ce3 100644 --- a/addon/components/hyper-table-v2/column.ts +++ b/addon/components/hyper-table-v2/column.ts @@ -63,6 +63,10 @@ export default class HyperTableV2Column extends Component + Promise.resolve({ + columns: [buildColumn('foo', { position: undefined }), buildColumn('bar', { position: undefined })] + }) + ); + + await render(hbs``); + + assert.dom('.hypertable__column--sticky-left').doesNotExist(); + assert.dom('.hypertable__column--sticky-right').doesNotExist(); + }); + + test('Sticky attribute provided with no side - column renders with sticky-left class', async function (this: TestContext, assert: Assert) { + sinon.stub(this.tableManager, 'fetchColumns').callsFake(() => + Promise.resolve({ + columns: [buildColumn('foo'), buildColumn('bar', { position: { sticky: true } })] + }) + ); + + await render(hbs``); + + assert.dom('.hypertable__column--sticky-left').exists(); + }); + + test('Sticky attribute provided with right side - column renders with sticky-right class', async function (this: TestContext, assert: Assert) { + sinon.stub(this.tableManager, 'fetchColumns').callsFake(() => { + return Promise.resolve({ + columns: [buildColumn('foo'), buildColumn('bar', { position: { sticky: true, side: 'right' } })] + }); + }); + + await render(hbs``); + + assert.dom('.hypertable__column--sticky-right').exists(); + }); + + test('Sticky attribute provided with left side - column renders with sticky-left class', async function (this: TestContext, assert: Assert) { + sinon.stub(this.tableManager, 'fetchColumns').callsFake(() => { + return Promise.resolve({ + columns: [buildColumn('foo'), buildColumn('bar', { position: { sticky: true, side: 'left' } })] + }); + }); + + await render(hbs``); + + assert.dom('.hypertable__column--sticky-left').exists(); + }); + }); });