Skip to content

Commit ec588f5

Browse files
committed
Get these passing on Canary
The babel polyfill is required to avoid a `ReferenceError: regeneratorRuntime is not defined` error.
1 parent dc4fc23 commit ec588f5

File tree

6 files changed

+118
-85
lines changed

6 files changed

+118
-85
lines changed

ember-cli-build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
55

66
module.exports = function(defaults) {
77
let app = new EmberAddon(defaults, {
8-
// Add options here
8+
'ember-cli-babel': {
9+
includePolyfill: true,
10+
}
911
});
1012

1113
/*
Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1-
import { moduleForComponent, test } from 'ember-qunit';
1+
import { module, test } from 'qunit';
2+
import { setupRenderingTest } from 'ember-qunit';
23
import hbs from 'htmlbars-inline-precompile';
4+
import { render } from '@ember/test-helpers';
35
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
46
import env from 'dummy/config/environment';
7+
import StripeService from 'dummy/services/stripev3';
58

6-
moduleForComponent('stripe-card-cvc', 'Integration | Component | stripe card cvc', {
7-
integration: true,
8-
beforeEach() {
9-
window.Stripe = StripeMock;
9+
module('Integration | Component | stripe card cvc', function(hooks) {
10+
setupRenderingTest(hooks);
1011

11-
let config = {
12+
hooks.beforeEach(function() {
13+
window.Stripe = StripeMock;
14+
const config = {
1215
mock: true,
13-
publishableKey: env.stripe.publishableKey
16+
publishableKey: env.stripe.publishableKey,
1417
};
1518

16-
this.register('config:stripe', config, { instantiate: false });
17-
this.inject.service('stripev3', 'config', 'config:stripe');
18-
}
19-
});
19+
this.owner.register(
20+
'service:stripev3',
21+
StripeService.create({ config }),
22+
{ instantiate: false }
23+
);
24+
});
2025

21-
test('it renders', function(assert) {
22-
this.render(hbs`{{stripe-card-cvc}}`);
26+
test('it renders', async function(assert) {
27+
await render(hbs`{{stripe-card-cvc}}`);
2328

24-
assert.equal(this.$().text().trim(), '');
29+
assert.equal(this.element.textContent.trim(), '');
30+
});
2531
});
Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1-
import { moduleForComponent, test } from 'ember-qunit';
1+
import { module, test } from 'qunit';
2+
import { setupRenderingTest } from 'ember-qunit';
23
import hbs from 'htmlbars-inline-precompile';
4+
import { render } from '@ember/test-helpers';
35
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
46
import env from 'dummy/config/environment';
7+
import StripeService from 'dummy/services/stripev3';
58

6-
moduleForComponent('stripe-card-expiry', 'Integration | Component | stripe card expiry', {
7-
integration: true,
8-
beforeEach() {
9-
window.Stripe = StripeMock;
9+
module('Integration | Component | stripe card expiry', function(hooks) {
10+
setupRenderingTest(hooks);
1011

11-
let config = {
12+
hooks.beforeEach(function() {
13+
window.Stripe = StripeMock;
14+
const config = {
1215
mock: true,
13-
publishableKey: env.stripe.publishableKey
16+
publishableKey: env.stripe.publishableKey,
1417
};
1518

16-
this.register('config:stripe', config, { instantiate: false });
17-
this.inject.service('stripev3', 'config', 'config:stripe');
18-
}
19-
});
19+
this.owner.register(
20+
'service:stripev3',
21+
StripeService.create({ config }),
22+
{ instantiate: false }
23+
);
24+
});
2025

21-
test('it renders', function(assert) {
22-
this.render(hbs`{{stripe-card-expiry}}`);
26+
test('it renders', async function(assert) {
27+
await render(hbs`{{stripe-card-expiry}}`);
2328

24-
assert.equal(this.$().text().trim(), '');
29+
assert.equal(this.element.textContent.trim(), '');
30+
});
2531
});
Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
1-
import { moduleForComponent, test } from 'ember-qunit';
1+
import { module, test } from 'qunit';
2+
import { setupRenderingTest } from 'ember-qunit';
23
import hbs from 'htmlbars-inline-precompile';
4+
import { render } from '@ember/test-helpers';
35
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
46
import env from 'dummy/config/environment';
7+
import StripeService from 'dummy/services/stripev3';
58

6-
moduleForComponent('stripe-card-number', 'Integration | Component | stripe card number', {
7-
integration: true,
8-
beforeEach() {
9-
window.Stripe = StripeMock;
9+
module('Integration | Component | stripe card number', function(hooks) {
10+
setupRenderingTest(hooks);
1011

11-
let config = {
12+
hooks.beforeEach(function() {
13+
window.Stripe = StripeMock;
14+
const config = {
1215
mock: true,
13-
publishableKey: env.stripe.publishableKey
16+
publishableKey: env.stripe.publishableKey,
1417
};
1518

16-
this.register('config:stripe', config, { instantiate: false });
17-
this.inject.service('stripev3', 'config', 'config:stripe');
18-
}
19-
});
19+
this.owner.register(
20+
'service:stripev3',
21+
StripeService.create({ config }),
22+
{ instantiate: false }
23+
);
24+
});
2025

21-
test('it renders', function(assert) {
22-
this.render(hbs`{{stripe-card-number}}`);
26+
test('it renders', async function(assert) {
27+
await render(hbs`{{stripe-card-number}}`);
2328

24-
assert.equal(this.$().text().trim(), '');
29+
assert.equal(this.element.textContent.trim(), '');
30+
});
2531
});
32+
Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
1-
import { moduleForComponent, test } from 'ember-qunit';
1+
import { module, test } from 'qunit';
2+
import { setupRenderingTest } from 'ember-qunit';
23
import hbs from 'htmlbars-inline-precompile';
4+
import { render } from '@ember/test-helpers';
35
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
46
import env from 'dummy/config/environment';
7+
import StripeService from 'dummy/services/stripev3';
58

6-
moduleForComponent('stripe-card', 'Integration | Component | stripe card', {
7-
integration: true,
8-
beforeEach() {
9-
window.Stripe = StripeMock;
9+
module('Integration | Component | stripe card', function(hooks) {
10+
setupRenderingTest(hooks);
1011

11-
let config = {
12+
hooks.beforeEach(function() {
13+
window.Stripe = StripeMock;
14+
const config = {
1215
mock: true,
13-
publishableKey: env.stripe.publishableKey
16+
publishableKey: env.stripe.publishableKey,
1417
};
1518

16-
this.register('config:stripe', config, { instantiate: false });
17-
this.inject.service('stripev3', 'config', 'config:stripe');
18-
}
19-
});
19+
this.owner.register(
20+
'service:stripev3',
21+
StripeService.create({ config }),
22+
{ instantiate: false }
23+
);
24+
});
2025

21-
test('it renders', function(assert) {
22-
// Template block usage:
23-
this.render(hbs`
24-
{{#stripe-card}}
25-
template block text
26-
{{/stripe-card}}
27-
`);
26+
test('it renders', async function(assert) {
27+
// Template block usage:
28+
await render(hbs`
29+
{{#stripe-card}}
30+
template block text
31+
{{/stripe-card}}
32+
`);
2833

29-
assert.equal(this.$().text().trim(), 'template block text');
30-
});
34+
assert.equal(this.element.textContent.trim(), 'template block text');
35+
});
3136

32-
test('yields out error message', function(assert) {
33-
this.stripeError = { message: 'oops' };
34-
this.render(hbs`
35-
{{#stripe-card stripeError=stripeError as |stripeElement stripeError|}}
36-
{{stripeError.message}}
37-
{{/stripe-card}}
38-
`);
37+
test('yields out error message', async function(assert) {
38+
this.stripeError = { message: 'oops' };
39+
await this.render(hbs`
40+
{{#stripe-card stripeError=stripeError as |stripeElement stripeError|}}
41+
{{stripeError.message}}
42+
{{/stripe-card}}
43+
`);
3944

40-
assert.equal(this.$().text().trim(), 'oops');
45+
assert.equal(this.element.textContent.trim(), 'oops');
46+
});
4147
});
Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1-
import { moduleForComponent, test } from 'ember-qunit';
1+
import { module, test } from 'qunit';
2+
import { setupRenderingTest } from 'ember-qunit';
23
import hbs from 'htmlbars-inline-precompile';
4+
import { render } from '@ember/test-helpers';
35
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
46
import env from 'dummy/config/environment';
7+
import StripeService from 'dummy/services/stripev3';
58

6-
moduleForComponent('stripe-postal-code', 'Integration | Component | stripe postal code', {
7-
integration: true,
8-
beforeEach() {
9-
window.Stripe = StripeMock;
9+
module('Integration | Component | stripe postal code', function(hooks) {
10+
setupRenderingTest(hooks);
1011

11-
let config = {
12+
hooks.beforeEach(function() {
13+
window.Stripe = StripeMock;
14+
const config = {
1215
mock: true,
13-
publishableKey: env.stripe.publishableKey
16+
publishableKey: env.stripe.publishableKey,
1417
};
1518

16-
this.register('config:stripe', config, { instantiate: false });
17-
this.inject.service('stripev3', 'config', 'config:stripe');
18-
}
19-
});
19+
this.owner.register(
20+
'service:stripev3',
21+
StripeService.create({ config }),
22+
{ instantiate: false }
23+
);
24+
});
2025

21-
test('it renders', function(assert) {
22-
this.render(hbs`{{stripe-postal-code}}`);
26+
test('it renders', async function(assert) {
27+
await render(hbs`{{stripe-postal-code}}`);
2328

24-
assert.equal(this.$().text().trim(), '');
29+
assert.equal(this.element.textContent.trim(), '');
30+
});
2531
});

0 commit comments

Comments
 (0)