glib-web 4.44.6 → 5.0.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 (98) hide show
  1. package/.github/workflows/lint.yml +2 -2
  2. package/.nycrc.json +3 -1
  3. package/README.md +9 -1
  4. package/agent/commands/generate_test.yaml +5 -5
  5. package/components/charts/series.js +23 -11
  6. package/components/component.vue +0 -5
  7. package/components/fields/checkGroup.vue +14 -7
  8. package/components/fields/richText2.vue +33 -3
  9. package/components/fields/upload.vue +5 -3
  10. package/components/mixins/styles.js +0 -1
  11. package/components/popover.vue +107 -78
  12. package/cypress/component/{inputUpload.cy.ts → inputUpload.cy.js} +3 -3
  13. package/cypress/component/{multiUpload.cy.ts → multiUpload.cy.js} +3 -3
  14. package/cypress/component/{placeholderUpload.cy.ts → placeholderUpload.cy.js} +3 -3
  15. package/cypress/component/{testUtils.ts → testUtils.js} +3 -15
  16. package/cypress/e2e/glib-web/{auth.cy.ts → auth.cy.js} +22 -1
  17. package/cypress/e2e/glib-web/{autoValidate.cy.ts → autoValidate.cy.js} +1 -1
  18. package/cypress/e2e/glib-web/{browsers.cy.ts → browsers.cy.js} +1 -1
  19. package/cypress/e2e/glib-web/{calendar.cy.ts → calendar.cy.js} +1 -1
  20. package/cypress/e2e/glib-web/{calendarEmptyData.cy.ts → calendarEmptyData.cy.js} +1 -1
  21. package/cypress/e2e/glib-web/{carousel.cy.ts → carousel.cy.js} +1 -1
  22. package/cypress/e2e/glib-web/{charts.cy.ts → charts.cy.js} +1 -1
  23. package/cypress/e2e/glib-web/{column.cy.ts → column.cy.js} +1 -1
  24. package/cypress/e2e/glib-web/{commands.cy.ts → commands.cy.js} +1 -1
  25. package/cypress/e2e/glib-web/{components.cy.ts → components.cy.js} +1 -1
  26. package/cypress/e2e/glib-web/{cookies.cy.ts → cookies.cy.js} +1 -1
  27. package/cypress/e2e/glib-web/{custom.cy.ts → custom.cy.js} +1 -1
  28. package/cypress/e2e/glib-web/dialog.cy.js +63 -0
  29. package/cypress/e2e/glib-web/{dialogOpen.cy.ts → dialogOpen.cy.js} +1 -1
  30. package/cypress/e2e/glib-web/{dirtyState.cy.ts → dirtyState.cy.js} +9 -24
  31. package/cypress/e2e/glib-web/{display.cy.ts → display.cy.js} +1 -1
  32. package/cypress/e2e/glib-web/{fields.cy.ts → fields.cy.js} +1 -1
  33. package/cypress/e2e/glib-web/{fieldsCaptcha.cy.ts → fieldsCaptcha.cy.js} +1 -1
  34. package/cypress/e2e/glib-web/fieldsCreditCard.cy.js +22 -0
  35. package/cypress/e2e/glib-web/fieldsDateTime.cy.js +48 -0
  36. package/cypress/e2e/glib-web/{fieldsDynamicSelect.cy.ts → fieldsDynamicSelect.cy.js} +1 -1
  37. package/cypress/e2e/glib-web/fieldsLocation.cy.js +40 -0
  38. package/cypress/e2e/glib-web/fieldsOtp.cy.js +68 -0
  39. package/cypress/e2e/glib-web/fieldsPhone.cy.js +87 -0
  40. package/cypress/e2e/glib-web/fieldsRating.cy.js +91 -0
  41. package/cypress/e2e/glib-web/fieldsRichText.cy.js +136 -0
  42. package/cypress/e2e/glib-web/{fieldsSelect.cy.ts → fieldsSelect.cy.js} +1 -1
  43. package/cypress/e2e/glib-web/{fieldsSign.cy.ts → fieldsSign.cy.js} +1 -1
  44. package/cypress/e2e/glib-web/fieldsStripeToken.cy.js +47 -0
  45. package/cypress/e2e/glib-web/{fieldsTimer.cy.ts → fieldsTimer.cy.js} +1 -1
  46. package/cypress/e2e/glib-web/fieldsUpload.cy.js +159 -0
  47. package/cypress/e2e/glib-web/{fieldsUrlFragment.cy.ts → fieldsUrlFragment.cy.js} +1 -1
  48. package/cypress/e2e/glib-web/{flow.cy.ts → flow.cy.js} +1 -1
  49. package/cypress/e2e/glib-web/{form.cy.ts → form.cy.js} +1 -1
  50. package/cypress/e2e/glib-web/{formDynamic.cy.ts → formDynamic.cy.js} +1 -1
  51. package/cypress/e2e/glib-web/{forms.cy.ts → forms.cy.js} +1 -1
  52. package/cypress/e2e/glib-web/{grid.cy.ts → grid.cy.js} +1 -1
  53. package/cypress/e2e/glib-web/{horizontal.cy.ts → horizontal.cy.js} +1 -1
  54. package/cypress/e2e/glib-web/{http.cy.ts → http.cy.js} +1 -1
  55. package/cypress/e2e/glib-web/{image.cy.ts → image.cy.js} +1 -1
  56. package/cypress/e2e/glib-web/{lifecycle.cy.ts → lifecycle.cy.js} +1 -1
  57. package/cypress/e2e/glib-web/{list.cy.ts → list.cy.js} +1 -1
  58. package/cypress/e2e/glib-web/{listEditable.cy.ts → listEditable.cy.js} +1 -1
  59. package/cypress/e2e/glib-web/{listsAppend.cy.ts → listsAppend.cy.js} +1 -1
  60. package/cypress/e2e/glib-web/{logicsSet.cy.ts → logicsSet.cy.js} +1 -1
  61. package/cypress/e2e/glib-web/{multimediaVideo.cy.ts → multimediaVideo.cy.js} +1 -1
  62. package/cypress/e2e/glib-web/{pagination.cy.ts → pagination.cy.js} +1 -1
  63. package/cypress/e2e/glib-web/{panels.cy.ts → panels.cy.js} +1 -1
  64. package/cypress/e2e/glib-web/{panelsBulkEdit2.cy.ts → panelsBulkEdit2.cy.js} +1 -1
  65. package/cypress/e2e/glib-web/{popovers.cy.ts → popovers.cy.js} +1 -1
  66. package/cypress/e2e/glib-web/{progressCircle.cy.ts → progressCircle.cy.js} +1 -1
  67. package/cypress/e2e/glib-web/{responsive.cy.ts → responsive.cy.js} +1 -1
  68. package/cypress/e2e/glib-web/{scroll.cy.ts → scroll.cy.js} +1 -1
  69. package/cypress/e2e/glib-web/{selectable.cy.ts → selectable.cy.js} +1 -1
  70. package/cypress/e2e/glib-web/{sheets.cy.ts → sheets.cy.js} +1 -1
  71. package/cypress/e2e/glib-web/{snackbars.cy.ts → snackbars.cy.js} +1 -1
  72. package/cypress/e2e/glib-web/{split.cy.ts → split.cy.js} +1 -1
  73. package/cypress/e2e/glib-web/{storageItems.cy.ts → storageItems.cy.js} +1 -1
  74. package/cypress/e2e/glib-web/{table.cy.ts → table.cy.js} +1 -1
  75. package/cypress/e2e/glib-web/{timeline.cy.ts → timeline.cy.js} +1 -1
  76. package/cypress/e2e/glib-web/{timeouts.cy.ts → timeouts.cy.js} +1 -1
  77. package/cypress/e2e/glib-web/{ul.cy.ts → ul.cy.js} +1 -1
  78. package/cypress/e2e/glib-web/{vertical.cy.ts → vertical.cy.js} +1 -1
  79. package/cypress/e2e/glib-web/{web.cy.ts → web.cy.js} +1 -1
  80. package/cypress/e2e/glib-web/window.cy.js +21 -0
  81. package/cypress/e2e/glib-web/{windows.cy.ts → windows.cy.js} +34 -2
  82. package/cypress/helper.js +19 -0
  83. package/cypress/support/{commands.ts → commands.js} +2 -2
  84. package/cypress/support/component.js +27 -0
  85. package/cypress/support/{e2e.ts → e2e.js} +18 -3
  86. package/{cypress.config.ts → cypress.config.js} +3 -2
  87. package/cypress.yml.example +6 -7
  88. package/doc/TESTING.md +2 -2
  89. package/package.json +1 -1
  90. package/components/composable/dropable.js +0 -52
  91. package/components/fields/googlePlace.vue +0 -162
  92. package/components/mixins/tooltip.js +0 -57
  93. package/cypress/e2e/glib-web/dialog.cy.ts +0 -25
  94. package/cypress/e2e/glib-web/fieldsUpload.cy.ts +0 -48
  95. package/cypress/e2e/glib-web/multiupload.cy.ts +0 -25
  96. package/cypress/e2e/glib-web/window.cy.ts +0 -14
  97. package/cypress/helper.ts +0 -7
  98. package/cypress/support/component.ts +0 -12
@@ -12,18 +12,6 @@ import Format from "../../utils/format";
12
12
  import Dom from "../../utils/dom";
13
13
  import Settings from "../../utils/settings";
14
14
 
15
- type GlibWindow = Window & {
16
- Utils?: {
17
- app: typeof App;
18
- type: typeof TypeUtils;
19
- url: typeof UrlUtils;
20
- format: typeof Format;
21
- dom: typeof Dom;
22
- settings: typeof Settings;
23
- };
24
- GLib?: typeof Framework;
25
- };
26
-
27
15
  const glibGlobals = {
28
16
  app: App,
29
17
  type: TypeUtils,
@@ -53,12 +41,12 @@ const glibMountGlobals = {
53
41
  };
54
42
 
55
43
  const setupGlibGlobals = () => {
56
- const win = window as GlibWindow;
44
+ const win = window;
57
45
  win.Utils = glibGlobals;
58
46
  win.GLib = Framework;
59
47
  };
60
48
 
61
- const mountWithGlib = (component: unknown, spec: Record<string, unknown>) => {
49
+ const mountWithGlib = (component, spec) => {
62
50
  mount(component, {
63
51
  props: { spec },
64
52
  global: glibMountGlobals,
@@ -67,7 +55,7 @@ const mountWithGlib = (component: unknown, spec: Record<string, unknown>) => {
67
55
 
68
56
  const restoreUploaderStartStub = () => {
69
57
  const start = Uploader.prototype.start;
70
- const restore = TypeUtils.isFunction(start) ? (start as { restore?: unknown }).restore : null;
58
+ const restore = TypeUtils.isFunction(start) ? start.restore : null;
71
59
  TypeUtils.ifFunction(restore, (fn) => fn.call(start));
72
60
  };
73
61
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('auth')
4
4
 
@@ -30,4 +30,25 @@ describe('auth', () => {
30
30
  cy.contains('auth/saveCsrfToken + http/post').click()
31
31
  cy.get('.v-dialog').should('contain.text', 'Method: POST')
32
32
  })
33
+
34
+ it('restarts the app', () => {
35
+ cy.visit(url)
36
+
37
+ cy.contains('auth/restart').click()
38
+ // cy.location('pathname').should('eq', '/')
39
+ })
40
+
41
+ it('runs credit card setup callbacks', () => {
42
+ cy.visit(url, {
43
+ onBeforeLoad(win) {
44
+ win.Stripe = () => ({
45
+ confirmCardSetup: () => Promise.resolve({}),
46
+ handleCardAction: () => Promise.resolve({})
47
+ })
48
+ }
49
+ })
50
+
51
+ cy.contains('auth/creditCard (setup only)').click()
52
+ // cy.contains('.v-snackbar', 'Card setup succeeded').should('exist')
53
+ })
33
54
  })
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
  const url = testPageUrl('auto_validate')
3
3
 
4
4
  describe('autoValidate', () => {
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('browsers')
4
4
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('calendar')
4
4
  const sheetSelector = '#calendar_main .v-sheet'
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('calendar_empty_data')
4
4
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('carousel')
4
4
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
  const url = testPageUrl('charts')
3
3
 
4
4
  describe('charts', () => {
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('column')
4
4
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('commands')
4
4
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('components')
4
4
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('cookies')
4
4
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('custom')
4
4
 
@@ -0,0 +1,63 @@
1
+ import { testPageUrl } from "../../helper.js";
2
+ import * as Type from "../../../utils/type.js";
3
+ const url = testPageUrl('dialog');
4
+
5
+ describe('dialog', () => {
6
+ it('updateExisting', () => {
7
+ cy.visit(url);
8
+ cy.contains('Dialog updateExisting').click();
9
+ cy.get('.v-dialog h1').should('contain.text', 'Hello world');
10
+ cy.get('.v-dialog .v-icon').should('exist');
11
+ cy.get('.v-dialog').contains('change dialog content').click();
12
+ cy.get('.v-dialog h1').should('contain.text', 'Hello world (updated)');
13
+ cy.get('.v-dialog .v-icon').should('not.exist');
14
+ });
15
+
16
+ it('open dialog', () => {
17
+ cy.visit(url);
18
+ cy.contains('Dialog open').click();
19
+ cy.get('.dialog-title > .close-btn').click();
20
+
21
+ cy.contains('Dialog open').click();
22
+ cy.get('.v-dialog').contains('close').click();
23
+
24
+ cy.get('.v-dialog').should('not.exist');
25
+ });
26
+
27
+ it('closeAll', () => {
28
+ cy.visit(url);
29
+ cy.contains('Dialog closeAll').click();
30
+ cy.get('.v-dialog', { timeout: 2000 }).should('exist');
31
+ cy.get('.v-dialog', { timeout: 4000 }).should('not.exist');
32
+ });
33
+
34
+ it('reload', () => {
35
+ cy.visit(url);
36
+ cy.contains('Dialog reload').click();
37
+ cy.get('.v-dialog').should('exist');
38
+ cy.get('.v-dialog').contains('Title');
39
+ cy.wait(1200);
40
+ cy.get('.v-dialog').should('exist');
41
+ });
42
+
43
+ // it('notification triggers dialog alert', () => {
44
+ // cy.visit(url)
45
+
46
+ // cy.window().then((win) => {
47
+ // if (Type.isNull(win.Push)) {
48
+ // win.Push = { create: () => Promise.resolve() }
49
+ // }
50
+
51
+ // cy.stub(win.Push, 'create').callsFake((_title, options) => {
52
+ // if (Type.isObject(options) && Type.isFunction(options.onClick)) {
53
+ // options.onClick.call({ close: () => { } })
54
+ // }
55
+ // return Promise.resolve()
56
+ // })
57
+ // })
58
+
59
+ // cy.contains('Dialog notification').click()
60
+ // cy.contains('.v-dialog', 'Perform action').should('exist')
61
+ // })
62
+
63
+ });
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
  const url = testPageUrl('dialog_open')
3
3
 
4
4
  describe('dialog open', () => {
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
  const url = testPageUrl('dirty_state')
3
3
  const prompt = 'Changes have not been saved. Are you sure you want to leave this page?'
4
4
 
@@ -25,10 +25,10 @@ describe('dirtyState', () => {
25
25
  return false;
26
26
  })
27
27
 
28
- cy.contains('multiupload').click()
28
+ cy.contains('fields_upload').click()
29
29
  cy.contains('Female').click()
30
- cy.contains('multiupload').click() // Try to navigate to another page
31
- cy.get('h2').should('contain.text', 'MultiUpload')
30
+ cy.contains('fields_upload').click() // Try to navigate to another page
31
+ cy.location('href').should('eq', testPageUrl('fields_upload'))
32
32
  })
33
33
 
34
34
  it('have different context between window and dialog', () => {
@@ -48,12 +48,12 @@ describe('dirtyState', () => {
48
48
 
49
49
  cy.then(() => expect(text).to.equal(prompt))
50
50
 
51
- cy.contains('multiupload').click() // Try to navigate to another page
52
- cy.get('h2').should('contain.text', 'MultiUpload')
51
+ cy.contains('fields_upload').click() // Try to navigate to another page
52
+ cy.location('href').should('eq', testPageUrl('fields_upload'))
53
53
  })
54
54
 
55
55
  it('pop on history back', () => {
56
- cy.visit(testPageUrl('multiupload'))
56
+ cy.visit(testPageUrl('fields_upload'))
57
57
  cy.contains('dirty_state').click()
58
58
 
59
59
  cy.contains('choice2').click()
@@ -71,21 +71,6 @@ describe('dirtyState', () => {
71
71
  // dirty state is removed after second try
72
72
  cy.go('back')
73
73
 
74
- cy.get('h2').should('contain.text', 'MultiUpload')
74
+ cy.location('href').should('eq', testPageUrl('fields_upload'))
75
75
  })
76
-
77
- it('trigger dirty prompt on windows/open updateExisting: true', () => {
78
- cy.visit(url)
79
- cy.contains('choice2').click() // make form dirty
80
- cy.contains('navigate').click() // windows/open updateExisting: true
81
-
82
- let text = ''
83
- cy.on('window:confirm', (str) => {
84
- text = str;
85
- return false;
86
- })
87
-
88
- cy.then(() => expect(text).to.equal(prompt))
89
-
90
- })
91
- })
76
+ })
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
  const url = testPageUrl('form')
3
3
 
4
4
  describe('display', () => {
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('fields')
4
4
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('fields_captcha')
4
4
 
@@ -0,0 +1,22 @@
1
+ import { testPageUrl } from "../../helper.js"
2
+
3
+ const url = testPageUrl('fields_creditCard')
4
+
5
+ describe('fields_creditCard', () => {
6
+ it('submits the form', () => {
7
+ cy.visit(url)
8
+
9
+ cy.contains('Submit').click()
10
+
11
+ cy.get('body').then(($body) => {
12
+ if ($body.find('.v-dialog').length) {
13
+ cy.get('.v-dialog').should('contain.text', 'Method: POST')
14
+ return
15
+ }
16
+
17
+ if ($body.find('.unformatted').length) {
18
+ cy.get('.unformatted').should('contain.text', 'Method: POST')
19
+ }
20
+ })
21
+ })
22
+ })
@@ -0,0 +1,48 @@
1
+ import { testPageUrl, withComponent } from "../../helper.js"
2
+
3
+ const url = testPageUrl('fields_date_time')
4
+
5
+ describe('fields_date_time', () => {
6
+ it('updates date actions', () => {
7
+ cy.visit(url)
8
+
9
+ cy.contains('Set today + 1 week').click()
10
+ cy.get('#date_status').should('contain.text', 'Date changed')
11
+
12
+ cy.contains('Clear date').click()
13
+ cy.get('#date_status').should('contain.text', 'Date changed')
14
+ cy.get('input[name="user[date_basic]"]').should('have.value', '')
15
+ })
16
+
17
+ it('updates datetime actions', () => {
18
+ cy.visit(url)
19
+
20
+ cy.contains('Set datetime (evening)').click()
21
+ cy.get('#datetime_status').should('contain.text', 'Datetime changed')
22
+ cy.get('input[name="user[datetime_basic]"]').should('have.value', '2024-12-12T18:45')
23
+
24
+ cy.contains('Clear datetime').click()
25
+ cy.get('#datetime_status').should('contain.text', 'Datetime changed')
26
+ cy.get('input[name="user[datetime_basic]"]').should('have.value', '')
27
+ })
28
+
29
+ it('toggles templates and disabled state', () => {
30
+ cy.visit(url)
31
+
32
+ cy.contains('Disable date').click()
33
+ cy.get('#date_basic').find('.v-input--disabled').should('exist')
34
+
35
+ cy.contains('Enable date').click()
36
+ cy.get('#date_basic').find('.v-input--disabled').should('not.exist')
37
+
38
+ cy.contains('Use text template').click()
39
+ withComponent('datetime_plain', (comp) => {
40
+ expect(comp.spec.template.type).to.eq('text')
41
+ })
42
+
43
+ cy.contains('Restore plain template').click()
44
+ withComponent('datetime_plain', (comp) => {
45
+ expect(comp.spec.template.type).to.eq('plain')
46
+ })
47
+ })
48
+ })
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('fields_dynamicSelect')
4
4
 
@@ -0,0 +1,40 @@
1
+ import { testPageUrl } from "../../helper.js"
2
+
3
+ const url = testPageUrl('fields_location')
4
+
5
+ describe('fields_location', () => {
6
+ // it('shows autocomplete suggestions', () => {
7
+ // cy.visit(url)
8
+
9
+ // cy.window().its('google').should('exist')
10
+
11
+ // cy.get('input[name="user[address]"]').clear().type('Sydney')
12
+
13
+ // cy.get('.pac-container', { timeout: 10000 }).should('be.visible')
14
+ // cy.get('.pac-container .pac-item').its('length').should('be.gt', 0)
15
+ // })
16
+
17
+ it('updates the zoom field', () => {
18
+ cy.visit(url)
19
+
20
+ cy.get('input[name="user[zoom]"]').clear().type('10')
21
+ cy.get('input[name="user[zoom]"]').should('have.value', '10')
22
+ })
23
+
24
+ it('submits the form', () => {
25
+ cy.visit(url)
26
+
27
+ cy.contains('Submit').click()
28
+
29
+ cy.get('body').then(($body) => {
30
+ if ($body.find('.v-dialog').length) {
31
+ cy.get('.v-dialog').should('contain.text', 'Method: POST')
32
+ return
33
+ }
34
+
35
+ if ($body.find('.unformatted').length) {
36
+ cy.get('.unformatted').should('contain.text', 'Method: POST')
37
+ }
38
+ })
39
+ })
40
+ })
@@ -0,0 +1,68 @@
1
+ import { testPageUrl, withComponent } from "../../helper.js"
2
+
3
+ const url = testPageUrl('fields_otp')
4
+
5
+ describe('fields_otp', () => {
6
+ it('switches otp variants', () => {
7
+ cy.visit(url)
8
+
9
+ cy.contains('Length 4 (text)').click()
10
+ withComponent('otp_basic', (comp) => {
11
+ expect(comp.spec.length).to.eq(4)
12
+ expect(comp.spec.type).to.eq('text')
13
+ expect(comp.fieldModel).to.eq('ABCD')
14
+ })
15
+ cy.get('#otp_variant_status').should('contain.text', 'Variant: 4 digits (text)')
16
+
17
+ cy.contains('Length 6 (number)').click()
18
+ withComponent('otp_basic', (comp) => {
19
+ expect(comp.spec.length).to.eq(6)
20
+ expect(comp.spec.type).to.eq('number')
21
+ expect(comp.fieldModel).to.eq('123456')
22
+ })
23
+ cy.get('#otp_variant_status').should('contain.text', 'Variant: 6 digits (number)')
24
+
25
+ cy.contains('Length 8 (text)').click()
26
+ withComponent('otp_basic', (comp) => {
27
+ expect(comp.spec.length).to.eq(8)
28
+ expect(comp.spec.type).to.eq('text')
29
+ expect(comp.fieldModel).to.eq('A1B2C3D4')
30
+ })
31
+ cy.get('#otp_variant_status').should('contain.text', 'Variant: 8 digits (text)')
32
+ })
33
+
34
+ it('updates status actions', () => {
35
+ cy.visit(url)
36
+
37
+ cy.contains('Autofill code').click()
38
+ withComponent('otp_basic', (comp) => {
39
+ expect(comp.fieldModel).to.eq('654321')
40
+ })
41
+ cy.get('#otp_status').should('contain.text', 'Status: code changed')
42
+
43
+ cy.contains('Clear code').click()
44
+ withComponent('otp_basic', (comp) => {
45
+ expect(comp.fieldModel).to.eq('')
46
+ })
47
+ cy.get('#otp_status').should('contain.text', 'Status: code changed')
48
+ })
49
+
50
+ it('toggles disabled and clears value', () => {
51
+ cy.visit(url)
52
+
53
+ cy.contains('Disable field').click()
54
+ withComponent('otp_basic', (comp) => {
55
+ expect(comp.spec.disabled).to.eq(true)
56
+ })
57
+
58
+ cy.contains('Enable field').click()
59
+ withComponent('otp_basic', (comp) => {
60
+ expect(comp.spec.disabled).to.not.eq(true)
61
+ })
62
+
63
+ cy.contains('Clear value').click()
64
+ withComponent('otp_basic', (comp) => {
65
+ expect(comp.fieldModel).to.eq('')
66
+ })
67
+ })
68
+ })
@@ -0,0 +1,87 @@
1
+ import { testPageUrl, withComponent } from "../../helper.js"
2
+
3
+ const url = testPageUrl('fields_phone')
4
+
5
+ describe('fields_phone', () => {
6
+ it('switches variants', () => {
7
+ cy.visit(url)
8
+
9
+ cy.contains('Auto-detect (default)').click()
10
+ withComponent('phone_basic', (comp) => {
11
+ expect(comp.spec.disableAutoDetect).to.not.eq(true)
12
+ expect(comp.spec.defaultCountry).to.not.eq('US')
13
+ expect(comp.spec.defaultCountry).to.not.eq('AU')
14
+ expect(comp.spec.label).to.eq('Phone number')
15
+ })
16
+ cy.get('#phone_variant_status').should('contain.text', 'Variant: auto-detect (default)')
17
+
18
+ cy.contains('Default country: US').click()
19
+ withComponent('phone_basic', (comp) => {
20
+ expect(comp.spec.disableAutoDetect).to.eq(true)
21
+ expect(comp.spec.defaultCountry).to.eq('US')
22
+ expect(comp.spec.label).to.eq('Phone (US default)')
23
+ })
24
+ cy.get('#phone_variant_status').should('contain.text', 'Variant: default country US')
25
+
26
+ cy.contains('Default country: AU').click()
27
+ withComponent('phone_basic', (comp) => {
28
+ expect(comp.spec.disableAutoDetect).to.eq(true)
29
+ expect(comp.spec.defaultCountry).to.eq('AU')
30
+ expect(comp.spec.label).to.eq('Phone (AU default)')
31
+ })
32
+ cy.get('#phone_variant_status').should('contain.text', 'Variant: default country AU')
33
+ })
34
+
35
+ it('updates values via actions', () => {
36
+ cy.visit(url)
37
+
38
+ cy.contains('Set sample number').click()
39
+ withComponent('phone_basic', (comp) => {
40
+ expect(comp.fieldModel).to.contain('+1')
41
+ })
42
+ cy.get('#phone_status').should('contain.text', 'Status: number changed')
43
+
44
+ cy.contains('Clear value').click()
45
+ withComponent('phone_basic', (comp) => {
46
+ expect(comp.fieldModel).to.eq('')
47
+ })
48
+ cy.get('#phone_status').should('contain.text', 'Status: number changed')
49
+ })
50
+
51
+ it('toggles disabled/read-only and submits', () => {
52
+ cy.visit(url)
53
+
54
+ cy.contains('Disable field').click()
55
+ withComponent('phone_basic', (comp) => {
56
+ expect(comp.spec.disabled).to.eq(true)
57
+ })
58
+
59
+ cy.contains('Enable field').click()
60
+ withComponent('phone_basic', (comp) => {
61
+ expect(comp.spec.disabled).to.not.eq(true)
62
+ })
63
+
64
+ cy.contains('Read-only').click()
65
+ withComponent('phone_basic', (comp) => {
66
+ expect(comp.spec.readOnly).to.eq(true)
67
+ })
68
+
69
+ cy.contains('Editable').click()
70
+ withComponent('phone_basic', (comp) => {
71
+ expect(comp.spec.readOnly).to.not.eq(true)
72
+ })
73
+
74
+ cy.contains('Submit').click()
75
+
76
+ cy.get('body').then(($body) => {
77
+ if ($body.find('.v-dialog').length) {
78
+ cy.get('.v-dialog').should('contain.text', 'Method: POST')
79
+ return
80
+ }
81
+
82
+ if ($body.find('.unformatted').length) {
83
+ cy.get('.unformatted').should('contain.text', 'Method: POST')
84
+ }
85
+ })
86
+ })
87
+ })