@ordergroove/offers 2.35.3 → 2.35.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/bundle-report.html +10 -10
  3. package/dist/examples.js +3 -2
  4. package/dist/examples.js.map +2 -2
  5. package/dist/offers.js +37 -52
  6. package/dist/offers.js.map +2 -2
  7. package/examples/index.html +1 -1
  8. package/examples/shopify-cart.html +5 -8
  9. package/examples/shopify-pdp.html +8 -12
  10. package/karma-functional.conf.js +1 -1
  11. package/karma-shopify.conf.js +1 -1
  12. package/karma.conf.js +1 -1
  13. package/package.json +4 -4
  14. package/src/components/FrequencyStatus.js +4 -4
  15. package/src/components/Modal.js +5 -7
  16. package/src/components/Offer.js +3 -1
  17. package/src/components/OptinToggle.js +2 -2
  18. package/src/components/Select.js +2 -1
  19. package/src/components/TestWizard.js +22 -35
  20. package/src/components/Tooltip.js +2 -6
  21. package/src/components/UpsellModal.js +2 -2
  22. package/src/components/__tests__/FrequencyStatus.spec.js +1 -1
  23. package/src/components/__tests__/OG.fspec.js +6 -10
  24. package/src/components/__tests__/Offer.spec.js +17 -17
  25. package/src/components/__tests__/OptinButton.spec.js +1 -1
  26. package/src/components/__tests__/PrepaidButton.spec.js +1 -1
  27. package/src/components/__tests__/PrepaidSelect.spec.js +1 -1
  28. package/src/components/__tests__/PrepaidToggle.spec.js +1 -1
  29. package/src/components/__tests__/Price.spec.js +6 -6
  30. package/src/components/__tests__/Select.spec.js +4 -4
  31. package/src/components/__tests__/SubscriptionButton.spec.js +1 -1
  32. package/src/core/__tests__/actions.spec.js +1 -1
  33. package/src/core/__tests__/localStorage.spec.js +3 -3
  34. package/src/core/__tests__/middleware.spec.js +12 -12
  35. package/src/core/actions-preview.js +1 -1
  36. package/src/core/actions.js +8 -6
  37. package/src/core/api.js +5 -13
  38. package/src/core/connect.js +29 -27
  39. package/src/core/middleware.js +12 -12
  40. package/src/core/reducer.js +3 -3
  41. package/src/core/utils.ts +4 -4
  42. package/src/run-tests.js +1 -1
  43. package/src/shopify/__tests__/shopifyReducer.spec.js +6 -6
  44. package/src/shopify/shopifyMiddleware.ts +2 -2
  45. package/src/shopify/shopifyReducer.js +1 -7
  46. package/src/test-mode.js +2 -2
  47. package/tsconfig.json +1 -4
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html>
3
3
  <head>
4
4
  <title>Ordergroove Offers</title>
@@ -1,9 +1,9 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html>
3
3
  <head>
4
4
  <title>Ordergroove Offers</title>
5
5
  </head>
6
- <body id="single-offer" >
6
+ <body id="single-offer">
7
7
  <h1>cart</h1>
8
8
  <og-offer product="40909392609469" id="regular1" location="cart" cart></og-offer>
9
9
  <!-- offers should be latest since it overides og.offers namespace -->
@@ -13,14 +13,11 @@
13
13
  routes: {
14
14
  root: './'
15
15
  }
16
- }
16
+ };
17
17
  </script>
18
18
  <script type="text/javascript" src="../dist/offers.js"></script>
19
19
  <script type="text/javascript">
20
- og
21
- .offers
22
- .initialize('0e5de2bedc5e11e3a2e4bc764e106cf4', 'staging')
20
+ og.offers.initialize('0e5de2bedc5e11e3a2e4bc764e106cf4', 'staging');
23
21
  </script>
24
-
25
22
  </body>
26
- </html>
23
+ </html>
@@ -1,18 +1,16 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html>
3
3
  <head>
4
4
  <title>Ordergroove Offers</title>
5
5
 
6
- <meta property="og:type" content="product">
7
- <meta property="og:url" content="https://claras-clocks.myshopify.com/products/cheap-watch">
8
-
6
+ <meta property="og:type" content="product" />
7
+ <meta property="og:url" content="https://claras-clocks.myshopify.com/products/cheap-watch" />
9
8
  </head>
10
- <body id="single-offer" >
11
-
9
+ <body id="single-offer">
12
10
  <form action="shopify-cart.html" menthod="POST">
13
11
  <og-offer product="40909392609469" id="regular1"></og-offer>
14
12
  <!-- offers should be latest since it overides og.offers namespace -->
15
- <button> Add to cart</button>
13
+ <button>Add to cart</button>
16
14
  </form>
17
15
 
18
16
  <script type="text/javascript">
@@ -20,15 +18,13 @@
20
18
  routes: {
21
19
  root: './'
22
20
  }
23
- }
21
+ };
24
22
  </script>
25
23
 
26
24
  <script type="text/javascript" src="../dist/offers.js"></script>
27
25
 
28
26
  <script type="text/javascript">
29
- og
30
- .offers
31
- .initialize('0e5de2bedc5e11e3a2e4bc764e106cf4', 'staging')
27
+ og.offers.initialize('0e5de2bedc5e11e3a2e4bc764e106cf4', 'staging');
32
28
  </script>
33
29
  </body>
34
- </html>
30
+ </html>
@@ -1,7 +1,7 @@
1
1
  // Karma configuration
2
2
  // Generated on Mon Apr 01 2019 14:32:09 GMT-0400 (EDT)
3
3
 
4
- module.exports = function(config) {
4
+ module.exports = function (config) {
5
5
  config.set({
6
6
  // frameworks to use
7
7
  // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
@@ -1,7 +1,7 @@
1
1
  // Karma configuration
2
2
  // Generated on Mon Apr 01 2019 14:32:09 GMT-0400 (EDT)
3
3
 
4
- module.exports = function(config) {
4
+ module.exports = function (config) {
5
5
  config.set({
6
6
  // frameworks to use
7
7
  // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
package/karma.conf.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Karma configuration
2
2
  // Generated on Mon Apr 01 2019 14:32:09 GMT-0400 (EDT)
3
3
 
4
- module.exports = function(config) {
4
+ module.exports = function (config) {
5
5
  config.set({
6
6
  // frameworks to use
7
7
  // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ordergroove/offers",
3
- "version": "2.35.3",
3
+ "version": "2.35.4",
4
4
  "description": "offer state component",
5
5
  "author": "Eugenio Lattanzio <eugenio63@gmail.com>",
6
6
  "homepage": "https://github.com/ordergroove/plush-toys#readme",
@@ -36,7 +36,7 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@ordergroove/auth": "^2.3.2",
39
- "@ordergroove/offers-live-editor": "^0.6.5",
39
+ "@ordergroove/offers-live-editor": "^0.6.6",
40
40
  "lit-element": "^2.1.0",
41
41
  "lodash.memoize": "^4.1.2",
42
42
  "logical-expression-parser": "1.0.0",
@@ -45,8 +45,8 @@
45
45
  "throttle-debounce": "^2.1.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@ordergroove/offers-templates": "^0.9.3",
48
+ "@ordergroove/offers-templates": "^0.9.4",
49
49
  "@types/lodash.memoize": "^4.1.9"
50
50
  },
51
- "gitHead": "521fa43f980842f76be9c12ab20ed6473ab905f7"
51
+ "gitHead": "31022c24ca8485d4d66fab276fc8e4b8fb6df05d"
52
52
  }
@@ -67,21 +67,21 @@ export class FrequencyStatus extends withProduct(TemplateElement) {
67
67
  <span>
68
68
  ${(this.subscribed &&
69
69
  html`
70
- <slot name="subscribed">${frequencyText(frequency)} </slot>
70
+ <slot name="subscribed">${frequencyText(frequency)}</slot>
71
71
  `) ||
72
- ''}
72
+ ''}
73
73
  ${(!this.subscribed &&
74
74
  html`
75
75
  <slot name="not-subscribed"></slot>
76
76
  `) ||
77
- ''}
77
+ ''}
78
78
  ${(this.subscribed &&
79
79
  this.defaultFrequency &&
80
80
  this.defaultFrequency !== this.frequency &&
81
81
  html`
82
82
  <slot name="frequency-mismatch"></slot>
83
83
  `) ||
84
- ''}
84
+ ''}
85
85
  </span>
86
86
  `;
87
87
  }
@@ -116,7 +116,9 @@ export class Modal extends LitElement {
116
116
  transform: translateZ(0);
117
117
  transition: -webkit-transform 0.25s ease-out;
118
118
  transition: transform 0.25s ease-out;
119
- transition: transform 0.25s ease-out, -webkit-transform 0.25s ease-out;
119
+ transition:
120
+ transform 0.25s ease-out,
121
+ -webkit-transform 0.25s ease-out;
120
122
  }
121
123
 
122
124
  .og-modal__btn:focus,
@@ -164,9 +166,7 @@ export class Modal extends LitElement {
164
166
  ? html`
165
167
  <span @click="${() => this.close()}" class="btn">
166
168
  <slot name="cancel">
167
- <button class="og-modal__btn og-modal__cancel" @click="${() => this.close()}">
168
- ${this.cancelText}
169
- </button>
169
+ <button class="og-modal__btn og-modal__cancel" @click="${() => this.close()}">${this.cancelText}</button>
170
170
  </slot>
171
171
  </span>
172
172
  `
@@ -189,9 +189,7 @@ export class Modal extends LitElement {
189
189
  <main class="og-modal__content">
190
190
  <slot name="content">${this.content}</slot>
191
191
  </main>
192
- <footer class="og-modal__footer">
193
- ${this.confirmButton} ${this.cancelButton}
194
- </footer>
192
+ <footer class="og-modal__footer">${this.confirmButton} ${this.cancelButton}</footer>
195
193
  </div>
196
194
  </div>
197
195
  </div>
@@ -122,7 +122,9 @@ export class Offer extends TemplateElement {
122
122
  transform: translateZ(0);
123
123
  transition: -webkit-transform 0.25s ease-out;
124
124
  transition: transform 0.25s ease-out;
125
- transition: transform 0.25s ease-out, -webkit-transform 0.25s ease-out;
125
+ transition:
126
+ transform 0.25s ease-out,
127
+ -webkit-transform 0.25s ease-out;
126
128
  }
127
129
 
128
130
  .og-modal__btn:focus,
@@ -67,8 +67,8 @@ export class OptinToggle extends OptinStatus {
67
67
  <button id="action-trigger" class="btn checkbox ${this.subscribed ? 'active' : ''}"></button>
68
68
  <label for="action-trigger">
69
69
  <slot>
70
- <slot name="label"><og-text key="offerOptInLabel"></og-text></slot
71
- ></slot>
70
+ <slot name="label"><og-text key="offerOptInLabel"></og-text></slot>
71
+ </slot>
72
72
  </label>
73
73
  </slot>
74
74
  `;
@@ -75,8 +75,9 @@ export class Select extends LitElement {
75
75
  value="${option.value}"
76
76
  ?selected=${option.value === this.selected}
77
77
  .selected=${option.value === this.selected}
78
- >${option.text}</option
79
78
  >
79
+ ${option.text}
80
+ </option>
80
81
  `
81
82
  )}
82
83
  </select>
@@ -150,41 +150,28 @@ export class TestWizard extends LitElement {
150
150
  <div class="message error">No offer element found on the page</div>
151
151
  `
152
152
  : this.results.map(
153
- (result, ix) =>
154
- html`
155
- <div>For offer tag with product = "${result.product}"</div>
156
- ${result.messages.map(
157
- message => html`
158
- <div class="message ${message.type}">
159
- ${message.name}
160
- </div>
161
- `
162
- )}
163
- <button @click=${this.toggleProductFlags(ix, {})}>
164
- Set inStock and eligible
165
- </button>
166
- <br />
167
- <button @click=${this.toggleProductFlags(ix, { inStock: false })}>
168
- Set to not inStock
169
- </button>
170
- <br />
171
- <button @click=${this.toggleProductFlags(ix, { autoship: false })}>
172
- Set to not eligible
173
- </button>
174
- <br />
175
- <button @click=${this.toggleProductFlags(ix, { autoship: false, inStock: false })}>
176
- Set to not eligible and not in stock
177
- </button>
178
- <br />
179
- <button @click=${this.toggleUpsellPreview(ix)}>
180
- Toggle upsell/regular in this offer
181
- </button>
182
- <br />
183
- <button @click=${this.toggleUpsellNextOrder(ix)}>
184
- upsell product is in next order
185
- </button>
186
- <br />
187
- `
153
+ (result, ix) => html`
154
+ <div>For offer tag with product = "${result.product}"</div>
155
+ ${result.messages.map(
156
+ message => html`
157
+ <div class="message ${message.type}">${message.name}</div>
158
+ `
159
+ )}
160
+ <button @click=${this.toggleProductFlags(ix, {})}>Set inStock and eligible</button>
161
+ <br />
162
+ <button @click=${this.toggleProductFlags(ix, { inStock: false })}>Set to not inStock</button>
163
+ <br />
164
+ <button @click=${this.toggleProductFlags(ix, { autoship: false })}>Set to not eligible</button>
165
+ <br />
166
+ <button @click=${this.toggleProductFlags(ix, { autoship: false, inStock: false })}>
167
+ Set to not eligible and not in stock
168
+ </button>
169
+ <br />
170
+ <button @click=${this.toggleUpsellPreview(ix)}>Toggle upsell/regular in this offer</button>
171
+ <br />
172
+ <button @click=${this.toggleUpsellNextOrder(ix)}>upsell product is in next order</button>
173
+ <br />
174
+ `
188
175
  );
189
176
  }
190
177
 
@@ -188,14 +188,10 @@ export class Tooltip extends LitElement {
188
188
  return html`
189
189
  <span class="tooltip">
190
190
  <span class="trigger">
191
- <slot name="trigger">
192
- ${this.trigger}
193
- </slot>
191
+ <slot name="trigger">${this.trigger}</slot>
194
192
  </span>
195
193
  <div class="content ${this.placement || 'bottom'}">
196
- <slot name="content">
197
- ${this.content}
198
- </slot>
194
+ <slot name="content">${this.content}</slot>
199
195
  </div>
200
196
  </span>
201
197
  `;
@@ -57,8 +57,8 @@ export class UpsellModal extends withProduct(TemplateElement) {
57
57
  </slot>
58
58
  </div>
59
59
  <span slot="confirm">
60
- <slot name="confirm"><og-text key="upsellModalConfirmLabel"></og-text></slot
61
- ></span>
60
+ <slot name="confirm"><og-text key="upsellModalConfirmLabel"></og-text></slot>
61
+ </span>
62
62
  <span slot="cancel">
63
63
  <slot name="cancel">
64
64
  <og-text key="upsellModalCancelLabel"></og-text>
@@ -3,7 +3,7 @@ import { appendToBody, querySelector } from './utils';
3
3
 
4
4
  customElements.define(`og-some-frequency-this-test`, FrequencyStatus);
5
5
 
6
- describe('FrequencyStatus', function() {
6
+ describe('FrequencyStatus', function () {
7
7
  it('should select default frequency', async () => {
8
8
  const element = new FrequencyStatus();
9
9
  element.setAttribute('product', '123');
@@ -44,7 +44,7 @@ const mockOfferResponse = (productId, inStock = true, autoship = true, defaultFr
44
44
  });
45
45
  };
46
46
 
47
- describe('og.offers', function() {
47
+ describe('og.offers', function () {
48
48
  it('should define og namespace', () => {
49
49
  expect(og).toEqual(jasmine.any(Object));
50
50
  expect(og.offers).toEqual(jasmine.any(Object));
@@ -79,19 +79,15 @@ describe('og.offers', function() {
79
79
  });
80
80
  });
81
81
 
82
- describe('Offer', function() {
82
+ describe('Offer', function () {
83
83
  let productIdNotInStock;
84
84
  let productIdInStock;
85
85
  let fetch;
86
86
 
87
87
  beforeEach(async () => {
88
88
  fetch = spyOn(window, 'fetch');
89
- productIdNotInStock = `oos${Math.random()
90
- .toString(36)
91
- .substring(2, 10)}`;
92
- productIdInStock = `s-${Math.random()
93
- .toString(36)
94
- .substring(2, 10)}`;
89
+ productIdNotInStock = `oos${Math.random().toString(36).substring(2, 10)}`;
90
+ productIdInStock = `s-${Math.random().toString(36).substring(2, 10)}`;
95
91
  });
96
92
 
97
93
  it('should show offer when instock and eligible', async () => {
@@ -179,7 +175,7 @@ describe('Offer', function() {
179
175
  expectNotToBeVisible(offer);
180
176
  });
181
177
 
182
- describe('Select Frequency', function() {
178
+ describe('Select Frequency', function () {
183
179
  let element;
184
180
  beforeEach(async () => {
185
181
  fetch.and.returnValue(mockOfferResponse(productIdInStock));
@@ -217,7 +213,7 @@ describe('Offer', function() {
217
213
  });
218
214
  });
219
215
 
220
- describe('optin default frequency tests', function() {
216
+ describe('optin default frequency tests', function () {
221
217
  let element;
222
218
  beforeEach(async () => {
223
219
  og.offers.clear();
@@ -3,8 +3,8 @@ import { appendToBody } from './utils';
3
3
 
4
4
  customElements.define('og-offer-test', Offer);
5
5
 
6
- describe('Offer', function() {
7
- beforeEach(function() {
6
+ describe('Offer', function () {
7
+ beforeEach(function () {
8
8
  this.underTest = new Offer();
9
9
  this.underTest.iuTemplate = jasmine.createSpy('iuTemplate');
10
10
  this.underTest.radioTemplate = jasmine.createSpy('radioTemplate');
@@ -14,8 +14,8 @@ describe('Offer', function() {
14
14
  this.underTest.dispatch = jasmine.createSpy('dispatch').and.returnValue(null);
15
15
  });
16
16
 
17
- describe('dispatch fetchOffer action', function() {
18
- it('should call dispatch with getOffer given product attribute has changed', async function() {
17
+ describe('dispatch fetchOffer action', function () {
18
+ it('should call dispatch with getOffer given product attribute has changed', async function () {
19
19
  await appendToBody(this.underTest);
20
20
  this.underTest.fetchOffer = jasmine.createSpy('fetchOffer');
21
21
  expect(this.underTest.fetchOffer).not.toHaveBeenCalledWith();
@@ -24,7 +24,7 @@ describe('Offer', function() {
24
24
  expect(this.underTest.fetchOffer).toHaveBeenCalledWith('yum product', 'pdp', this.underTest);
25
25
  });
26
26
 
27
- it('should not call dispatch given product attribute has not changed', async function() {
27
+ it('should not call dispatch given product attribute has not changed', async function () {
28
28
  await appendToBody(this.underTest);
29
29
  this.underTest.fetchOffer = jasmine.createSpy('fetchOffer');
30
30
  expect(this.underTest.fetchOffer).not.toHaveBeenCalledWith();
@@ -34,8 +34,8 @@ describe('Offer', function() {
34
34
  });
35
35
  });
36
36
 
37
- describe('dispatch firstOrderPlaceDate action', function() {
38
- it('should call dispatch with firstOrderPlaceDate given when attribute has changed', async function() {
37
+ describe('dispatch firstOrderPlaceDate action', function () {
38
+ it('should call dispatch with firstOrderPlaceDate given when attribute has changed', async function () {
39
39
  await appendToBody(this.underTest);
40
40
  this.underTest.fetchOffer = jasmine.createSpy('fetchOffer');
41
41
  this.underTest.setFirstOrderPlaceDate = jasmine.createSpy('setFirstOrderPlaceDate');
@@ -46,7 +46,7 @@ describe('Offer', function() {
46
46
  expect(this.underTest.setFirstOrderPlaceDate).toHaveBeenCalledWith('yum product', '2022-09-25');
47
47
  });
48
48
 
49
- it('should not call dispatch given firstOrderPlaceDate attribute has not changed', async function() {
49
+ it('should not call dispatch given firstOrderPlaceDate attribute has not changed', async function () {
50
50
  await appendToBody(this.underTest);
51
51
  this.underTest.fetchOffer = jasmine.createSpy('fetchOffer');
52
52
  this.underTest.setFirstOrderPlaceDate = jasmine.createSpy('setFirstOrderPlaceDate');
@@ -57,8 +57,8 @@ describe('Offer', function() {
57
57
  });
58
58
  });
59
59
 
60
- describe('dispatch productToSubscribe action', function() {
61
- it('should call dispatch with productToSubscribe given when attribute has changed', async function() {
60
+ describe('dispatch productToSubscribe action', function () {
61
+ it('should call dispatch with productToSubscribe given when attribute has changed', async function () {
62
62
  await appendToBody(this.underTest);
63
63
  this.underTest.fetchOffer = jasmine.createSpy('fetchOffer');
64
64
  this.underTest.setProductToSubscribe = jasmine.createSpy('setProductToSubscribe');
@@ -69,7 +69,7 @@ describe('Offer', function() {
69
69
  expect(this.underTest.setProductToSubscribe).toHaveBeenCalledWith('yum product', 'some-other-product');
70
70
  });
71
71
 
72
- it('should not call dispatch given productToSubscribe attribute has not changed', async function() {
72
+ it('should not call dispatch given productToSubscribe attribute has not changed', async function () {
73
73
  await appendToBody(this.underTest);
74
74
  this.underTest.fetchOffer = jasmine.createSpy('fetchOffer');
75
75
  this.underTest.setProductToSubscribe = jasmine.createSpy('setProductToSubscribe');
@@ -80,8 +80,8 @@ describe('Offer', function() {
80
80
  });
81
81
  });
82
82
 
83
- describe('dispatch productHasChangedComponents action', function() {
84
- it('should call dispatch with productHasChangedComponents given productComponents attribute has changed', async function() {
83
+ describe('dispatch productHasChangedComponents action', function () {
84
+ it('should call dispatch with productHasChangedComponents given productComponents attribute has changed', async function () {
85
85
  await appendToBody(this.underTest);
86
86
  this.underTest.productHasChangedComponents = jasmine.createSpy('productHasChangedComponents');
87
87
  expect(this.underTest.productHasChangedComponents).not.toHaveBeenCalledWith();
@@ -94,7 +94,7 @@ describe('Offer', function() {
94
94
  );
95
95
  });
96
96
 
97
- it('should not call dispatch with productHasChangedComponents given productComponents attribute has not changed', async function() {
97
+ it('should not call dispatch with productHasChangedComponents given productComponents attribute has not changed', async function () {
98
98
  await appendToBody(this.underTest);
99
99
  this.underTest.productHasChangedComponents = jasmine.createSpy('productHasChangedComponents');
100
100
  expect(this.underTest.productHasChangedComponents).not.toHaveBeenCalledWith();
@@ -103,7 +103,7 @@ describe('Offer', function() {
103
103
  expect(this.underTest.productHasChangedComponents).not.toHaveBeenCalled();
104
104
  });
105
105
 
106
- it('should call fetchOrders', async function() {
106
+ it('should call fetchOrders', async function () {
107
107
  await appendToBody(this.underTest);
108
108
  this.underTest.fetchOrders = jasmine.createSpy('fetchOrders');
109
109
  this.underTest.auth = {};
@@ -112,7 +112,7 @@ describe('Offer', function() {
112
112
  });
113
113
  });
114
114
 
115
- describe('autoshipByDefault', function() {
115
+ describe('autoshipByDefault', function () {
116
116
  it('should optin by default if matches location=cart', async () => {
117
117
  const el = new Offer();
118
118
  el.innerHTML = '<!-- empty -->';
@@ -240,7 +240,7 @@ describe('mapStateToProps', () => {
240
240
  expect(
241
241
  mapStateToProps(
242
242
  {
243
- productOffer: { '123': ['fancy-offer-a'] }
243
+ productOffer: { 123: ['fancy-offer-a'] }
244
244
  },
245
245
  {
246
246
  product: { id: '123' }
@@ -3,7 +3,7 @@ import { appendToBody, simulateClick, querySelector } from './utils';
3
3
 
4
4
  customElements.define('og-optin-button-test', OptinButton);
5
5
 
6
- describe('OptinButton', function() {
6
+ describe('OptinButton', function () {
7
7
  describe('unit test', () => {
8
8
  it('should show button active if subscribed', async () => {
9
9
  const element = new OptinButton();
@@ -8,7 +8,7 @@ customElements.define(TAG_NAME_UNDER_TEST, PrepaidButton);
8
8
 
9
9
  function getPrepaidButtonTemplate(options = [3, 6]) {
10
10
  return html`
11
- <og-some-prepaid-button product="yum product" .options=${options}> </og-some-prepaid-button>
11
+ <og-some-prepaid-button product="yum product" .options=${options}></og-some-prepaid-button>
12
12
  `;
13
13
  }
14
14
 
@@ -8,7 +8,7 @@ customElements.define(TAG_NAME_UNDER_TEST, PrepaidSelect);
8
8
 
9
9
  function getPrepaidSelectTemplate(options = [3, 6]) {
10
10
  return html`
11
- <og-some-prepaid-select product="yum product" .options=${options}> </og-some-prepaid-select>
11
+ <og-some-prepaid-select product="yum product" .options=${options}></og-some-prepaid-select>
12
12
  `;
13
13
  }
14
14
 
@@ -8,7 +8,7 @@ customElements.define(TAG_NAME_UNDER_TEST, PrepaidToggle);
8
8
 
9
9
  function getPrepaidToggleTemplate(options = [3, 6]) {
10
10
  return html`
11
- <og-some-prepaid-toggle product="yum product" .options=${options}> </og-some-prepaid-toggle>
11
+ <og-some-prepaid-toggle product="yum product" .options=${options}></og-some-prepaid-toggle>
12
12
  `;
13
13
  }
14
14
 
@@ -47,7 +47,7 @@ describe('Price', () => {
47
47
 
48
48
  it('should render subscription price', async () => {
49
49
  const template = html`
50
- <og-some-price product="yum id"> </og-some-price>
50
+ <og-some-price product="yum id"></og-some-price>
51
51
  `;
52
52
  const priceDiv = await renderPriceTemplate(template);
53
53
  const insideText = priceDiv.shadowRoot.textContent.trim();
@@ -56,7 +56,7 @@ describe('Price', () => {
56
56
 
57
57
  it('should render regular price', async () => {
58
58
  const template = html`
59
- <og-some-price regular product="yum id"> </og-some-price>
59
+ <og-some-price regular product="yum id"></og-some-price>
60
60
  `;
61
61
  const priceDiv = await renderPriceTemplate(template);
62
62
  const insideText = priceDiv.shadowRoot.textContent.trim();
@@ -65,7 +65,7 @@ describe('Price', () => {
65
65
 
66
66
  it('should render discount price', async () => {
67
67
  const template = html`
68
- <og-some-price discount product="yum id"> </og-some-price>
68
+ <og-some-price discount product="yum id"></og-some-price>
69
69
  `;
70
70
  const priceDiv = await renderPriceTemplate(template);
71
71
  const insideText = priceDiv.shadowRoot.textContent.trim();
@@ -74,7 +74,7 @@ describe('Price', () => {
74
74
 
75
75
  it('should render payAsYouGo price with undefined prepaidShipments', async () => {
76
76
  const template = html`
77
- <og-some-price pay-as-you-go product="yum id"> </og-some-price>
77
+ <og-some-price pay-as-you-go product="yum id"></og-some-price>
78
78
  `;
79
79
  await renderPriceTemplate(template, {
80
80
  frequency: '1_3',
@@ -107,7 +107,7 @@ describe('Price', () => {
107
107
 
108
108
  it('should render payAsYouGo price with nullish prepaidShipments', async () => {
109
109
  const template = html`
110
- <og-some-price pay-as-you-go product="yum id"> </og-some-price>
110
+ <og-some-price pay-as-you-go product="yum id"></og-some-price>
111
111
  `;
112
112
  const priceDivNullPrepaid = await renderPriceTemplate(template, {
113
113
  frequency: '1_3',
@@ -143,7 +143,7 @@ describe('Price', () => {
143
143
 
144
144
  it('should render empty price when subscription is equal to regular', async () => {
145
145
  const template = html`
146
- <og-some-price discount product="yum id"> </og-some-price>
146
+ <og-some-price discount product="yum id"></og-some-price>
147
147
  `;
148
148
  const priceDiv = await renderPriceTemplate(template, {
149
149
  frequency: '1_3',
@@ -19,9 +19,9 @@ describe('Select', () => {
19
19
  await appendToBody(element);
20
20
  expect(element.shadowRoot.querySelectorAll('option').length).toBe(2);
21
21
  expect(element.shadowRoot.querySelectorAll('option')[0].value).toBe('egg');
22
- expect(element.shadowRoot.querySelectorAll('option')[0].innerText).toBe('yum egg');
22
+ expect(element.shadowRoot.querySelectorAll('option')[0].innerText.trim()).toBe('yum egg');
23
23
  expect(element.shadowRoot.querySelectorAll('option')[1].value).toBe('clam');
24
- expect(element.shadowRoot.querySelectorAll('option')[1].innerText).toBe('yum clam');
24
+ expect(element.shadowRoot.querySelectorAll('option')[1].innerText.trim()).toBe('yum clam');
25
25
  });
26
26
 
27
27
  it('should select selected option', async () => {
@@ -40,10 +40,10 @@ describe('Select', () => {
40
40
  await appendToBody(element);
41
41
  expect(element.shadowRoot.querySelectorAll('option').length).toBe(2);
42
42
  expect(element.shadowRoot.querySelectorAll('option')[0].value).toBe('egg');
43
- expect(element.shadowRoot.querySelectorAll('option')[0].innerText).toBe('yum egg');
43
+ expect(element.shadowRoot.querySelectorAll('option')[0].innerText.trim()).toBe('yum egg');
44
44
  expect(element.shadowRoot.querySelectorAll('option')[0].selected).toBe(true);
45
45
  expect(element.shadowRoot.querySelectorAll('option')[1].value).toBe('clam');
46
- expect(element.shadowRoot.querySelectorAll('option')[1].innerText).toBe('yum clam');
46
+ expect(element.shadowRoot.querySelectorAll('option')[1].innerText.trim()).toBe('yum clam');
47
47
  expect(element.shadowRoot.querySelectorAll('option')[1].selected).toBe(false);
48
48
  });
49
49
  });
@@ -3,7 +3,7 @@ import { appendToBody, simulateClick, querySelector } from './utils';
3
3
 
4
4
  customElements.define('og-subscription-button-test', SubscriptionButton);
5
5
 
6
- describe('SubscriptionButton', function() {
6
+ describe('SubscriptionButton', function () {
7
7
  describe('unit test', () => {
8
8
  it('should show button active if subscribed', async () => {
9
9
  const element = new SubscriptionButton();
@@ -24,7 +24,7 @@ import {
24
24
  import * as constants from '../constants';
25
25
  import { api } from '../api';
26
26
 
27
- describe('redux actions', function() {
27
+ describe('redux actions', function () {
28
28
  it('setEnvironment should return dev payload given dev env', () => {
29
29
  expect(setEnvironment('dev')).toEqual({
30
30
  type: 'SET_ENVIRONMENT_DEV',