Skip to content

Commit

Permalink
3.0: Drop minor compat code in testing for 1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed Aug 10, 2020
1 parent 81e1f85 commit 456c4c8
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions tests/integration/components/headers/ember-thead-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,25 +129,14 @@ async function testColumnAddition(assert, table) {
assert.equal(table.containerWidth, originalContainerWidth, 'table container width is unchanged');
}

// In Ember-1.12, the `this` context has a `context` property itself that is used to `get` or `set`.
// This function provides Ember-1.12 compatibility for `this.get`
function compatGet(context, propName) {
return context.get ? context.get(propName) : context.context.get(propName);
}

// This function provides Ember-1.12 compatibility for `this.set`
function compatSet(context, propName, value) {
return context.set ? context.set(propName, value) : context.context.set(propName, value);
}

moduleForComponent('ember-thead', '[Unit] ember-thead', { integration: true });

test('table resizes when columns are removed', async function(assert) {
let data = tableData();
this.set('rows', data.rows);
this.set('columns', data.columns);
this.on('removeColumn', function() {
compatSet(this, 'columns', compatGet(this, 'columns').slice(0, -1));
this.set('columns', this.get('columns').slice(0, -1));
});

await renderTable(this);
Expand All @@ -159,7 +148,7 @@ test('table resizes when columns are removed via mutation', async function(asser
this.set('rows', data.rows);
this.set('columns', A(data.columns));
this.on('removeColumn', function() {
compatGet(this, 'columns').popObject();
this.get('columns').popObject();
});

await renderTable(this);
Expand All @@ -171,7 +160,7 @@ test('table resizes when columns are added', async function(assert) {
this.set('rows', data.rows);
this.set('columns', data.columns);
this.on('addColumn', function() {
compatSet(this, 'columns', [...data.columns, data.newColumn]);
this.set('columns', [...data.columns, data.newColumn]);
});

await renderTable(this);
Expand All @@ -183,7 +172,7 @@ test('table resizes when columns are added via mutation', async function(assert)
this.set('rows', data.rows);
this.set('columns', A(data.columns));
this.on('addColumn', function() {
compatGet(this, 'columns').pushObject(data.newColumn);
this.get('columns').pushObject(data.newColumn);
});

await renderTable(this);
Expand Down

0 comments on commit 456c4c8

Please sign in to comment.