@atlaskit/popup 1.17.2 → 1.18.0

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.
@@ -7,41 +7,41 @@ import transformer from '../1.0.0-lite-mode';
7
7
  const applyTransform = require('jscodeshift/dist/testUtils').applyTransform;
8
8
 
9
9
  type TestArgs = {
10
- it: string;
11
- original: string;
12
- expected: string;
13
- mode?: 'only' | 'skip';
14
- before?: () => void;
15
- after?: () => void;
10
+ it: string;
11
+ original: string;
12
+ expected: string;
13
+ mode?: 'only' | 'skip';
14
+ before?: () => void;
15
+ after?: () => void;
16
16
  };
17
17
 
18
18
  function check({
19
- it: name,
20
- original,
21
- expected,
22
- before = noop,
23
- after = noop,
24
- mode = undefined,
19
+ it: name,
20
+ original,
21
+ expected,
22
+ before = noop,
23
+ after = noop,
24
+ mode = undefined,
25
25
  }: TestArgs) {
26
- const run = mode === 'only' ? it.only : mode === 'skip' ? it.skip : it;
27
-
28
- run(name, () => {
29
- before();
30
- try {
31
- const output: string = applyTransform(
32
- { default: transformer, parser: 'tsx' },
33
- {},
34
- { source: original },
35
- );
36
- expect(output).toBe(expected.trim());
37
- } catch (e) {
38
- // a failed assertion will throw
39
- after();
40
- throw e;
41
- }
42
- // will only be hit if we don't throw
43
- after();
44
- });
26
+ const run = mode === 'only' ? it.only : mode === 'skip' ? it.skip : it;
27
+
28
+ run(name, () => {
29
+ before();
30
+ try {
31
+ const output: string = applyTransform(
32
+ { default: transformer, parser: 'tsx' },
33
+ {},
34
+ { source: original },
35
+ );
36
+ expect(output).toBe(expected.trim());
37
+ } catch (e) {
38
+ // a failed assertion will throw
39
+ after();
40
+ throw e;
41
+ }
42
+ // will only be hit if we don't throw
43
+ after();
44
+ });
45
45
  }
46
46
 
47
47
  /**
@@ -53,9 +53,9 @@ function check({
53
53
  */
54
54
 
55
55
  describe('Convert boundaries props', () => {
56
- check({
57
- it: 'should turn `boundariesElement="scrollParents"` to `boundary="clippingParents"`',
58
- original: `
56
+ check({
57
+ it: 'should turn `boundariesElement="scrollParents"` to `boundary="clippingParents"`',
58
+ original: `
59
59
  import Popup from '@atlaskit/popup';
60
60
 
61
61
  export default () => (
@@ -73,7 +73,7 @@ describe('Convert boundaries props', () => {
73
73
  />
74
74
  );
75
75
  `,
76
- expected: `
76
+ expected: `
77
77
  import Popup from '@atlaskit/popup';
78
78
 
79
79
  export default () => (
@@ -91,11 +91,11 @@ describe('Convert boundaries props', () => {
91
91
  />
92
92
  );
93
93
  `,
94
- });
94
+ });
95
95
 
96
- check({
97
- it: 'should turn `boundariesElement="window"` into `rootBoundary="document"`',
98
- original: `
96
+ check({
97
+ it: 'should turn `boundariesElement="window"` into `rootBoundary="document"`',
98
+ original: `
99
99
  import Popup from '@atlaskit/popup';
100
100
 
101
101
  export default () => (
@@ -113,7 +113,7 @@ describe('Convert boundaries props', () => {
113
113
  />
114
114
  );
115
115
  `,
116
- expected: `
116
+ expected: `
117
117
  import Popup from '@atlaskit/popup';
118
118
 
119
119
  export default () => (
@@ -131,11 +131,11 @@ describe('Convert boundaries props', () => {
131
131
  />
132
132
  );
133
133
  `,
134
- });
134
+ });
135
135
 
136
- check({
137
- it: 'should turn `boundariesElement="viewport"` into `rootBoundary="viewport"`',
138
- original: `
136
+ check({
137
+ it: 'should turn `boundariesElement="viewport"` into `rootBoundary="viewport"`',
138
+ original: `
139
139
  import Popup from '@atlaskit/popup';
140
140
 
141
141
  export default () => (
@@ -153,7 +153,7 @@ describe('Convert boundaries props', () => {
153
153
  />
154
154
  );
155
155
  `,
156
- expected: `
156
+ expected: `
157
157
  import Popup from '@atlaskit/popup';
158
158
 
159
159
  export default () => (
@@ -171,16 +171,16 @@ describe('Convert boundaries props', () => {
171
171
  />
172
172
  );
173
173
  `,
174
- });
174
+ });
175
175
  });
176
176
 
177
177
  describe('Convert offset props', () => {
178
- /**
179
- * `offset` prop is no longer a string, but an array of two integers (i.e. '0px 8px' is now [0, 8])
180
- */
181
- check({
182
- it: 'should convert offset from a string to an array of two integers',
183
- original: `
178
+ /**
179
+ * `offset` prop is no longer a string, but an array of two integers (i.e. '0px 8px' is now [0, 8])
180
+ */
181
+ check({
182
+ it: 'should convert offset from a string to an array of two integers',
183
+ original: `
184
184
  import Popup from '@atlaskit/popup';
185
185
 
186
186
  export default () => (
@@ -245,7 +245,7 @@ describe('Convert offset props', () => {
245
245
  );
246
246
  }
247
247
  `,
248
- expected: `
248
+ expected: `
249
249
  import Popup from '@atlaskit/popup';
250
250
 
251
251
  export default () => (
@@ -310,13 +310,13 @@ describe('Convert offset props', () => {
310
310
  );
311
311
  }
312
312
  `,
313
- });
314
- /**
315
- * If a user is passing in an offset with vh, vw or % in the offset, let them know that's no longer supported
316
- */
317
- check({
318
- it: 'should warn users using vh, vw or % in the offset',
319
- original: `
313
+ });
314
+ /**
315
+ * If a user is passing in an offset with vh, vw or % in the offset, let them know that's no longer supported
316
+ */
317
+ check({
318
+ it: 'should warn users using vh, vw or % in the offset',
319
+ original: `
320
320
  import Popup from '@atlaskit/popup';
321
321
 
322
322
  export default () => (
@@ -333,7 +333,7 @@ describe('Convert offset props', () => {
333
333
  />
334
334
  );
335
335
  `,
336
- expected: `
336
+ expected: `
337
337
  /* TODO: (from codemod) Popper.js has been upgraded from 1.14.1 to 2.4.2,
338
338
  and as a result the offset prop has changed to be an array. e.g '0px 8px' -> [0, 8]
339
339
  Along with this change you cannot use vw, vh or % units or addition or multiplication
@@ -355,14 +355,14 @@ describe('Convert offset props', () => {
355
355
  />
356
356
  );
357
357
  `,
358
- });
359
-
360
- /**
361
- * If a user is passing in a variable for offset then we should leave a comment to update it themselves
362
- */
363
- check({
364
- it: 'warn users passing in a variable for an offset',
365
- original: `
358
+ });
359
+
360
+ /**
361
+ * If a user is passing in a variable for offset then we should leave a comment to update it themselves
362
+ */
363
+ check({
364
+ it: 'warn users passing in a variable for an offset',
365
+ original: `
366
366
  import Popup from '@atlaskit/popup';
367
367
 
368
368
  function directOffset({offset}) {
@@ -381,7 +381,7 @@ describe('Convert offset props', () => {
381
381
  );
382
382
  }
383
383
  `,
384
- expected: `
384
+ expected: `
385
385
  /* TODO: (from codemod) Popper.js has been upgraded from 1.14.1 to 2.4.2, and as a result the offset
386
386
  prop has changed to be an array. e.g '0px 8px' -> [0, 8]
387
387
  As you are using a variable, you will have change the offset prop manually
@@ -404,11 +404,11 @@ describe('Convert offset props', () => {
404
404
  );
405
405
  }
406
406
  `,
407
- });
408
- // Works with an aliased import and other imports
409
- check({
410
- it: 'should work with aliased import and other imports',
411
- original: `
407
+ });
408
+ // Works with an aliased import and other imports
409
+ check({
410
+ it: 'should work with aliased import and other imports',
411
+ original: `
412
412
 
413
413
  import AkPopup, { PopupProps as AkPopupProps, TriggerProps as AkTriggerProps } from '@atlaskit/popup';
414
414
 
@@ -426,7 +426,7 @@ describe('Convert offset props', () => {
426
426
  />
427
427
  );
428
428
  `,
429
- expected: `
429
+ expected: `
430
430
  import AkPopup, { PopupProps as AkPopupProps, TriggerProps as AkTriggerProps } from '@atlaskit/popup';
431
431
 
432
432
  export default () => (
@@ -443,12 +443,12 @@ describe('Convert offset props', () => {
443
443
  />
444
444
  );
445
445
  `,
446
- });
446
+ });
447
447
 
448
- // Works when not a default import
449
- check({
450
- it: 'should work when not accessed using a default import',
451
- original: `
448
+ // Works when not a default import
449
+ check({
450
+ it: 'should work when not accessed using a default import',
451
+ original: `
452
452
  import { Popup } from '@atlaskit/popup';
453
453
 
454
454
  export default () => (
@@ -465,7 +465,7 @@ describe('Convert offset props', () => {
465
465
  />
466
466
  );
467
467
  `,
468
- expected: `
468
+ expected: `
469
469
  import { Popup } from '@atlaskit/popup';
470
470
 
471
471
  export default () => (
@@ -482,7 +482,7 @@ describe('Convert offset props', () => {
482
482
  />
483
483
  );
484
484
  `,
485
- });
485
+ });
486
486
  });
487
487
 
488
488
  /**
@@ -490,9 +490,9 @@ describe('Convert offset props', () => {
490
490
  * - `scheduleUpdate`, for async updates, has been renamed to `update`, and now returns a Promise.
491
491
  */
492
492
  describe('Convert render props', () => {
493
- check({
494
- it: 'should rename schedulUpdate to `update`',
495
- original: `
493
+ check({
494
+ it: 'should rename schedulUpdate to `update`',
495
+ original: `
496
496
  import Popup from '@atlaskit/popup';
497
497
 
498
498
  export default () => (
@@ -509,7 +509,7 @@ describe('Convert render props', () => {
509
509
  />
510
510
  );
511
511
  `,
512
- expected: `
512
+ expected: `
513
513
  import Popup from '@atlaskit/popup';
514
514
 
515
515
  export default () => (
@@ -528,5 +528,5 @@ describe('Convert render props', () => {
528
528
  />
529
529
  );
530
530
  `,
531
- });
531
+ });
532
532
  });