-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/integration: Replace
moduleForComponent()
with `setupRenderin…
…gTest()`
- Loading branch information
Showing
2 changed files
with
96 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 41 additions & 39 deletions
80
tests/integration/strip-data-test-attributes-from-tags-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,60 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
import config from 'dummy/config/environment'; | ||
|
||
moduleForComponent('data-test-component', 'StripTestSelectorsTransform plugin', { | ||
integration: true | ||
}); | ||
module('StripTestSelectorsTransform plugin', function(hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
if (config.stripTestSelectors) { | ||
if (config.stripTestSelectors) { | ||
|
||
test('it strips data-test-* attributes from HTML tags', function(assert) { | ||
this.render(hbs`<span data-test-id="my-id" ></span>`); | ||
test('it strips data-test-* attributes from HTML tags', async function(assert) { | ||
await render(hbs`<span data-test-id="my-id" ></span>`); | ||
|
||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-test-id="my-id"]').doesNotExist('data-test-id is stripped'); | ||
}); | ||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-test-id="my-id"]').doesNotExist('data-test-id is stripped'); | ||
}); | ||
|
||
test('it works with multiple data-test-* attributes on HTML tags', function(assert) { | ||
this.render(hbs`<span data-test-first data-test-second="second-id" ></span>`); | ||
test('it works with multiple data-test-* attributes on HTML tags', async function(assert) { | ||
await render(hbs`<span data-test-first data-test-second="second-id" ></span>`); | ||
|
||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-test-first]').doesNotExist('data-test-first is stripped'); | ||
assert.dom('span[data-test-second="second-id"]').doesNotExist('data-test-second is stripped'); | ||
}); | ||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-test-first]').doesNotExist('data-test-first is stripped'); | ||
assert.dom('span[data-test-second="second-id"]').doesNotExist('data-test-second is stripped'); | ||
}); | ||
|
||
test('it leaves other data attributes untouched, when a data-test-* attribute is present as well on HTML tags', function(assert) { | ||
this.render(hbs`<span data-id="my-id" data-test-id="my-test-id" ></span>`); | ||
test('it leaves other data attributes untouched, when a data-test-* attribute is present as well on HTML tags', async function(assert) { | ||
await render(hbs`<span data-id="my-id" data-test-id="my-test-id" ></span>`); | ||
|
||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-id="my-id"]').exists('data-id is not stripped'); | ||
assert.dom('span[data-test-id="my-test-id"]').doesNotExist('data-test-id is stripped'); | ||
}); | ||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-id="my-id"]').exists('data-id is not stripped'); | ||
assert.dom('span[data-test-id="my-test-id"]').doesNotExist('data-test-id is stripped'); | ||
}); | ||
|
||
test('it leaves data-test attributes untouched on HTML tags', function(assert) { | ||
this.render(hbs`<span data-test="my-id" ></span>`); | ||
test('it leaves data-test attributes untouched on HTML tags', async function(assert) { | ||
await render(hbs`<span data-test="my-id" ></span>`); | ||
|
||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-test="my-id"]').exists('data-test-id is not stripped'); | ||
}); | ||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-test="my-id"]').exists('data-test-id is not stripped'); | ||
}); | ||
|
||
test('it leaves other data attributes untouched on HTML tags', function(assert) { | ||
this.render(hbs`<span data-id="my-id" ></span>`); | ||
test('it leaves other data attributes untouched on HTML tags', async function(assert) { | ||
await render(hbs`<span data-id="my-id" ></span>`); | ||
|
||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-id="my-id"]').exists('data-id is not stripped'); | ||
}); | ||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-id="my-id"]').exists('data-id is not stripped'); | ||
}); | ||
|
||
} else { | ||
} else { | ||
|
||
test('it does not strip data-test-* attributes from HTML tags', function(assert) { | ||
this.render(hbs`<span data-test-id="my-id" ></span>`); | ||
test('it does not strip data-test-* attributes from HTML tags', async function(assert) { | ||
await render(hbs`<span data-test-id="my-id" ></span>`); | ||
|
||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-test-id="my-id"]').exists('data-test-id is not stripped'); | ||
}); | ||
assert.dom('span').exists('the span is present'); | ||
assert.dom('span[data-test-id="my-id"]').exists('data-test-id is not stripped'); | ||
}); | ||
|
||
} | ||
} | ||
}); |