Skip to content

Commit

Permalink
Replaces integration tests with unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xcambar authored and mathieupoteriepeopledoc committed Sep 3, 2018
1 parent cec0303 commit ca673f5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 34 deletions.
34 changes: 0 additions & 34 deletions tests/integration/bind-data-test-attributes-test.js

This file was deleted.

28 changes: 28 additions & 0 deletions tests/unit/utils/bind-data-test-attributes-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { module, test } from 'qunit';
import EmberObject, { computed } from '@ember/object';
import config from 'dummy/config/environment';

import bindDataTestAttributes from 'ember-test-selectors/utils/bind-data-test-attributes';

Expand Down Expand Up @@ -118,3 +119,30 @@ test('it skips if attributeBindings is a computed property', function(assert) {

assert.deepEqual(instance.get('attributeBindings'), ['foo']);
});

if (!config.stripTestSelectors) {
test('it breaks if tagName is empty', function(assert) {
let Fixture = EmberObject.extend({
tagName: '',
'data-test-from-factory': 'foo',
});
let instance = Fixture.create({
'data-test-from-invocation': 'bar',
});

assert.throws(() => bindDataTestAttributes(instance));
});
} else {
test('it does not break if tagName is empty and selectors are stripped', function(assert) {
let Fixture = EmberObject.extend({
tagName: '',
'data-test-from-factory': 'foo',
});
let instance = Fixture.create({
'data-test-from-invocation': 'bar',
});

bindDataTestAttributes(instance);
assert.ok(true);
});
}

0 comments on commit ca673f5

Please sign in to comment.