glib-web 5.0.0 → 5.0.5

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 (99) hide show
  1. package/README.md +8 -1
  2. package/actions/browsers/detectCountry.js +4 -1
  3. package/actions/dialogs/notification.js +4 -1
  4. package/actions/logics/run.js +4 -1
  5. package/actions/logics/set.js +6 -2
  6. package/agent/commands/generate_test.yaml +5 -5
  7. package/components/composable/date.js +4 -1
  8. package/components/datetime.vue +4 -1
  9. package/components/fields/phone/field.vue +4 -1
  10. package/components/mixins/styles.js +6 -2
  11. package/components/panels/bulkEdit2.vue +4 -1
  12. package/components/panels/custom.vue +1 -1
  13. package/components/popover.vue +49 -19
  14. package/components/shareButton.vue +4 -1
  15. package/components/treeView.vue +4 -1
  16. package/cypress/component/{inputUpload.cy.ts → inputUpload.cy.js} +3 -3
  17. package/cypress/component/{multiUpload.cy.ts → multiUpload.cy.js} +3 -3
  18. package/cypress/component/{placeholderUpload.cy.ts → placeholderUpload.cy.js} +3 -3
  19. package/cypress/component/{testUtils.ts → testUtils.js} +3 -15
  20. package/cypress/e2e/glib-web/{auth.cy.ts → auth.cy.js} +1 -1
  21. package/cypress/e2e/glib-web/{autoValidate.cy.ts → autoValidate.cy.js} +1 -1
  22. package/cypress/e2e/glib-web/{browsers.cy.ts → browsers.cy.js} +1 -1
  23. package/cypress/e2e/glib-web/{calendar.cy.ts → calendar.cy.js} +1 -1
  24. package/cypress/e2e/glib-web/{calendarEmptyData.cy.ts → calendarEmptyData.cy.js} +1 -1
  25. package/cypress/e2e/glib-web/{carousel.cy.ts → carousel.cy.js} +1 -1
  26. package/cypress/e2e/glib-web/{charts.cy.ts → charts.cy.js} +1 -1
  27. package/cypress/e2e/glib-web/{column.cy.ts → column.cy.js} +1 -1
  28. package/cypress/e2e/glib-web/{commands.cy.ts → commands.cy.js} +1 -1
  29. package/cypress/e2e/glib-web/{components.cy.ts → components.cy.js} +1 -1
  30. package/cypress/e2e/glib-web/{cookies.cy.ts → cookies.cy.js} +1 -1
  31. package/cypress/e2e/glib-web/{custom.cy.ts → custom.cy.js} +1 -1
  32. package/cypress/e2e/glib-web/dialog.cy.js +63 -0
  33. package/cypress/e2e/glib-web/{dialogOpen.cy.ts → dialogOpen.cy.js} +1 -1
  34. package/cypress/e2e/glib-web/{dirtyState.cy.ts → dirtyState.cy.js} +1 -1
  35. package/cypress/e2e/glib-web/{display.cy.ts → display.cy.js} +1 -1
  36. package/cypress/e2e/glib-web/{fields.cy.ts → fields.cy.js} +1 -1
  37. package/cypress/e2e/glib-web/{fieldsCaptcha.cy.ts → fieldsCaptcha.cy.js} +1 -1
  38. package/cypress/e2e/glib-web/{fieldsCreditCard.cy.ts → fieldsCreditCard.cy.js} +1 -1
  39. package/cypress/e2e/glib-web/{fieldsDateTime.cy.ts → fieldsDateTime.cy.js} +1 -1
  40. package/cypress/e2e/glib-web/{fieldsDynamicSelect.cy.ts → fieldsDynamicSelect.cy.js} +1 -1
  41. package/cypress/e2e/glib-web/{fieldsLocation.cy.ts → fieldsLocation.cy.js} +1 -1
  42. package/cypress/e2e/glib-web/{fieldsOtp.cy.ts → fieldsOtp.cy.js} +1 -1
  43. package/cypress/e2e/glib-web/{fieldsPhone.cy.ts → fieldsPhone.cy.js} +1 -1
  44. package/cypress/e2e/glib-web/{fieldsRating.cy.ts → fieldsRating.cy.js} +1 -1
  45. package/cypress/e2e/glib-web/{fieldsRichText.cy.ts → fieldsRichText.cy.js} +16 -17
  46. package/cypress/e2e/glib-web/{fieldsSelect.cy.ts → fieldsSelect.cy.js} +1 -1
  47. package/cypress/e2e/glib-web/{fieldsSign.cy.ts → fieldsSign.cy.js} +1 -1
  48. package/cypress/e2e/glib-web/{fieldsStripeToken.cy.ts → fieldsStripeToken.cy.js} +1 -1
  49. package/cypress/e2e/glib-web/{fieldsTimer.cy.ts → fieldsTimer.cy.js} +1 -1
  50. package/cypress/e2e/glib-web/{fieldsUpload.cy.ts → fieldsUpload.cy.js} +1 -1
  51. package/cypress/e2e/glib-web/{fieldsUrlFragment.cy.ts → fieldsUrlFragment.cy.js} +1 -1
  52. package/cypress/e2e/glib-web/{flow.cy.ts → flow.cy.js} +1 -1
  53. package/cypress/e2e/glib-web/{form.cy.ts → form.cy.js} +1 -1
  54. package/cypress/e2e/glib-web/{formDynamic.cy.ts → formDynamic.cy.js} +1 -1
  55. package/cypress/e2e/glib-web/{forms.cy.ts → forms.cy.js} +1 -1
  56. package/cypress/e2e/glib-web/{grid.cy.ts → grid.cy.js} +1 -1
  57. package/cypress/e2e/glib-web/{horizontal.cy.ts → horizontal.cy.js} +1 -1
  58. package/cypress/e2e/glib-web/{http.cy.ts → http.cy.js} +1 -1
  59. package/cypress/e2e/glib-web/{image.cy.ts → image.cy.js} +1 -1
  60. package/cypress/e2e/glib-web/{lifecycle.cy.ts → lifecycle.cy.js} +1 -1
  61. package/cypress/e2e/glib-web/{list.cy.ts → list.cy.js} +1 -1
  62. package/cypress/e2e/glib-web/{listEditable.cy.ts → listEditable.cy.js} +1 -1
  63. package/cypress/e2e/glib-web/{listsAppend.cy.ts → listsAppend.cy.js} +1 -1
  64. package/cypress/e2e/glib-web/{logicsSet.cy.ts → logicsSet.cy.js} +1 -1
  65. package/cypress/e2e/glib-web/{multimediaVideo.cy.ts → multimediaVideo.cy.js} +1 -1
  66. package/cypress/e2e/glib-web/{pagination.cy.ts → pagination.cy.js} +1 -1
  67. package/cypress/e2e/glib-web/{panels.cy.ts → panels.cy.js} +1 -1
  68. package/cypress/e2e/glib-web/{panelsBulkEdit2.cy.ts → panelsBulkEdit2.cy.js} +1 -1
  69. package/cypress/e2e/glib-web/{popovers.cy.ts → popovers.cy.js} +1 -1
  70. package/cypress/e2e/glib-web/{progressCircle.cy.ts → progressCircle.cy.js} +1 -1
  71. package/cypress/e2e/glib-web/{responsive.cy.ts → responsive.cy.js} +1 -1
  72. package/cypress/e2e/glib-web/{scroll.cy.ts → scroll.cy.js} +1 -1
  73. package/cypress/e2e/glib-web/{selectable.cy.ts → selectable.cy.js} +1 -1
  74. package/cypress/e2e/glib-web/{sheets.cy.ts → sheets.cy.js} +1 -1
  75. package/cypress/e2e/glib-web/{snackbars.cy.ts → snackbars.cy.js} +1 -1
  76. package/cypress/e2e/glib-web/{split.cy.ts → split.cy.js} +1 -1
  77. package/cypress/e2e/glib-web/{storageItems.cy.ts → storageItems.cy.js} +1 -1
  78. package/cypress/e2e/glib-web/{table.cy.ts → table.cy.js} +1 -1
  79. package/cypress/e2e/glib-web/{timeline.cy.ts → timeline.cy.js} +1 -1
  80. package/cypress/e2e/glib-web/{timeouts.cy.ts → timeouts.cy.js} +1 -1
  81. package/cypress/e2e/glib-web/{ul.cy.ts → ul.cy.js} +1 -1
  82. package/cypress/e2e/glib-web/{vertical.cy.ts → vertical.cy.js} +1 -1
  83. package/cypress/e2e/glib-web/{web.cy.ts → web.cy.js} +1 -1
  84. package/cypress/e2e/glib-web/{window.cy.ts → window.cy.js} +1 -1
  85. package/cypress/e2e/glib-web/{windows.cy.ts → windows.cy.js} +1 -1
  86. package/cypress/support/{commands.ts → commands.js} +2 -2
  87. package/cypress/support/{component.ts → component.js} +3 -3
  88. package/cypress/support/{e2e.ts → e2e.js} +3 -3
  89. package/{cypress.config.ts → cypress.config.js} +3 -2
  90. package/cypress.yml.example +6 -7
  91. package/doc/TESTING.md +2 -2
  92. package/index.js +4 -1
  93. package/package.json +1 -1
  94. package/templates/unsupported.vue +2 -2
  95. package/utils/eventBus.js +4 -1
  96. package/utils/hash.js +4 -1
  97. package/utils/interop.js +9 -0
  98. package/cypress/e2e/glib-web/dialog.cy.ts +0 -63
  99. /package/cypress/{helper.ts → helper.js} +0 -0
package/README.md CHANGED
@@ -20,7 +20,7 @@ module.exports = defineConfig({
20
20
  e2e: {
21
21
  specPattern: 'node_modules/glib-web/cypress/e2e',
22
22
  defaultBrowser: 'chrome',
23
- supportFile: 'node_modules/glib-web/cypress/support/e2e.{js,jsx,ts,tsx}'
23
+ supportFile: 'node_modules/glib-web/cypress/support/e2e.js'
24
24
  },
25
25
  });
26
26
  ```
@@ -30,6 +30,13 @@ module.exports = defineConfig({
30
30
  - Run rails server `bin/rails s`
31
31
  - Execute `yarn run cypress run`
32
32
 
33
+ ## Run Cypress tests (glib-web-npm)
34
+
35
+ 1. Clone and set up the backend repo (`glib-web`) because Cypress tests require matching `test_page/*` fixtures.
36
+ 2. In `glib-web`, link this package: `yarn link glib-web`.
37
+ 3. In project that use `glib-web`, start Rails: `bin/rails s` and `bin/vite dev` separately.
38
+ 4. In this repo, run tests: `yarn test`.
39
+
33
40
  ## Best practices
34
41
 
35
42
  - To prevent circular dependencies between components:
@@ -3,7 +3,10 @@
3
3
  import countries from "moment-timezone/data/meta/latest.json";
4
4
  import Action from "../../action";
5
5
  import http from "../../utils/http";
6
- import merge from 'lodash.merge';
6
+ import * as mergeModule from 'lodash.merge';
7
+ import { interopDefault } from "../../utils/interop.js";
8
+
9
+ const merge = interopDefault(mergeModule);
7
10
 
8
11
  export default class {
9
12
  async execute(spec, component) {
@@ -1,4 +1,7 @@
1
- import Push from "push.js";
1
+ import * as PushModule from "push.js";
2
+ import { interopDefault } from "../../utils/interop.js";
3
+
4
+ const Push = interopDefault(PushModule);
2
5
 
3
6
  export default class {
4
7
  execute(properties, component) {
@@ -1,9 +1,12 @@
1
- import jsonLogic from 'json-logic-js';
1
+ import * as jsonLogicModule from 'json-logic-js';
2
+ import { interopDefault } from "../../utils/interop.js";
2
3
  // Method "closest" return nothing, so use getAllFormData instead
3
4
  // One page can consist of many forms
4
5
  // so please use carefully
5
6
  import { getAllFormData } from "../../components/composable/form";
6
7
 
8
+ const jsonLogic = interopDefault(jsonLogicModule);
9
+
7
10
  export default class {
8
11
  execute(spec, component) {
9
12
  let condition = spec.condition;
@@ -1,10 +1,14 @@
1
- import jsonLogic from 'json-logic-js';
2
- import merge from 'lodash.merge';
1
+ import * as jsonLogicModule from 'json-logic-js';
2
+ import * as mergeModule from 'lodash.merge';
3
3
  import { nextTick } from "vue";
4
4
  import { sanitize } from "../../components/composable/date";
5
5
  import { isPresent } from "../../utils/type";
6
+ import { interopDefault } from "../../utils/interop.js";
6
7
  import { getFormData as _getFormData } from "../../components/composable/form";
7
8
 
9
+ const jsonLogic = interopDefault(jsonLogicModule);
10
+ const merge = interopDefault(mergeModule);
11
+
8
12
  const sumDate = function (a, b) {
9
13
  const date = new Date(a);
10
14
  const tzoffset = date.getTimezoneOffset() * 60000;
@@ -7,7 +7,7 @@ description: >
7
7
  inputs:
8
8
  doc_dir: doc/garage/test_page
9
9
  test_dir: cypress/e2e/glib-web
10
- test_helper: cypress/helper.ts
10
+ test_helper: cypress/helper.js
11
11
  ai_test_prompt: |
12
12
  Generate a Cypress e2e test for the glib test page: {{page_slug}}.
13
13
  Inputs you can use:
@@ -79,10 +79,10 @@ steps:
79
79
 
80
80
  - id: collect-test-page-slugs
81
81
  instruction: |
82
- Scan every *.cy.ts under {{inputs.test_dir}} and extract all occurrences of
82
+ Scan every *.cy.js under {{inputs.test_dir}} and extract all occurrences of
83
83
  testPageUrl('...'). Collect the string values into test_page_slugs.
84
84
  If a file contains no testPageUrl calls, derive a fallback slug by:
85
- - Removing the .cy.ts suffix.
85
+ - Removing the .cy.js suffix.
86
86
  - Converting camelCase to snake_case.
87
87
  Output: test_page_slugs.
88
88
 
@@ -102,8 +102,8 @@ steps:
102
102
  - id: scaffold-missing-tests
103
103
  instruction: |
104
104
  For each slug in missing_page_slugs:
105
- 1) Derive a filename by converting snake_case to camelCase and append ".cy.ts".
106
- Example: file_upload_new -> fileUploadNew.cy.ts
105
+ 1) Derive a filename by converting snake_case to camelCase and append ".cy.js".
106
+ Example: file_upload_new -> fileUploadNew.cy.js
107
107
  2) Create {{inputs.test_dir}}/<filename> if it does not already exist.
108
108
  3) Write generated_tests_map[<slug>] to the file.
109
109
  Output: created_test_files.
@@ -1,5 +1,8 @@
1
- import moment from "moment-timezone";
1
+ import * as momentModule from "moment-timezone";
2
2
  import { isString } from "../../utils/type";
3
+ import { interopDefault } from "../../utils/interop.js";
4
+
5
+ const moment = interopDefault(momentModule);
3
6
 
4
7
  export function sanitize(val, type, timeZone) {
5
8
  if (!val) return;
@@ -3,8 +3,11 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
- import moment from "moment";
6
+ import * as momentModule from "moment";
7
7
  import GlibBase from "./base/glibBase.js";
8
+ import { interopDefault } from "../utils/interop.js";
9
+
10
+ const moment = interopDefault(momentModule);
8
11
 
9
12
  export default {
10
13
  extends: GlibBase,
@@ -26,8 +26,11 @@
26
26
 
27
27
  <script>
28
28
  import GlibBase from "../../base/glibBase.js";
29
- import PhoneNumber from "awesome-phonenumber";
29
+ import * as PhoneNumberModule from "awesome-phonenumber";
30
30
  import allCountries from "./countries";
31
+ import { interopDefault } from "../../../utils/interop.js";
32
+
33
+ const PhoneNumber = interopDefault(PhoneNumberModule);
31
34
 
32
35
  function getCountryByIp() {
33
36
  return fetch("https://ip2c.org/s")
@@ -2,8 +2,12 @@ import Hash from "../../utils/hash";
2
2
  import { determineColor } from "../../utils/constant";
3
3
  import { triggerOnChange } from "../composable/form";
4
4
  import { realComponent } from "../helper";
5
- import set from "lodash.set";
6
- import merge from "lodash.merge";
5
+ import * as setModule from "lodash.set";
6
+ import * as mergeModule from "lodash.merge";
7
+ import { interopDefault } from "../../utils/interop.js";
8
+
9
+ const set = interopDefault(setModule);
10
+ const merge = interopDefault(mergeModule);
7
11
  const NUMBER_PRECISION = 2;
8
12
  const isNeedToBeFixed = (val, component) => {
9
13
  return component.type == 'number' && !Number.isInteger(val) && Number.isFinite(val);
@@ -70,9 +70,12 @@ export default {
70
70
  import { computed, getCurrentInstance, onMounted, reactive, ref, watch } from "vue";
71
71
  import Action from "../../action";
72
72
  import Hash from "../../utils/hash";
73
- import Papa from "papaparse";
73
+ import * as PapaModule from "papaparse";
74
74
  import launch from "../../utils/launch";
75
75
  import { isPresent } from "../../utils/type";
76
+ import { interopDefault } from "../../utils/interop.js";
77
+
78
+ const Papa = interopDefault(PapaModule);
76
79
 
77
80
  class Row {
78
81
  constructor({ id, columns, selected, index, status }) {
@@ -14,7 +14,7 @@
14
14
  -->
15
15
  <!-- <component ref="ccomp" :is="template" v-if="customData" :name="spec.template" :spec="customData" /> -->
16
16
 
17
- <component :is="template" :name="spec.template" :spec="contentSpec" />
17
+ <component :is="template" :compName="spec.template" :spec="contentSpec" />
18
18
 
19
19
  </div>
20
20
  </template>
@@ -46,6 +46,7 @@ export default {
46
46
  busCloseHandler: null,
47
47
  onAppClick: null,
48
48
  onResize: null,
49
+ dialogClickEl: null,
49
50
  body: null,
50
51
  };
51
52
  },
@@ -59,29 +60,63 @@ export default {
59
60
  },
60
61
  mounted() {
61
62
  popovers.value.push(this);
62
- this.busOpenHandler = (body) => {
63
- this.body = body;
64
- this.key = strandom();
65
- };
66
- bus.$on(`popovers/open-${this.spec.key}`, this.busOpenHandler);
63
+ this.registerBusOpen();
64
+ this.handleMounted();
67
65
  },
68
66
  methods: {
69
- $mounted() {
70
- const appEl = document.getElementById(APP_ID);
67
+ registerBusOpen() {
68
+ this.busOpenHandler = (body) => {
69
+ this.body = body;
70
+ this.key = strandom();
71
+ };
72
+ bus.$on(`popovers/open-${this.spec.key}`, this.busOpenHandler);
73
+ },
74
+ registerBusClose(appEl) {
71
75
  this.busCloseHandler = () => {
72
76
  if (appEl) {
73
77
  appEl.removeEventListener("click", this.onAppClick);
74
78
  }
79
+ if (TypeUtils.isNotNull(this.dialogClickEl)) {
80
+ this.dialogClickEl.removeEventListener("click", this.onAppClick);
81
+ }
75
82
  this.close();
76
83
  };
77
84
  bus.$once(`popover/close-${this.spec.key}`, this.busCloseHandler);
85
+ },
86
+ registerOutsideListeners(appEl) {
87
+ this.onAppClick = this.handleClose;
88
+ if (appEl) {
89
+ appEl.addEventListener("click", this.onAppClick);
90
+ }
91
+ this.dialogClickEl = this.resolveDialogEl();
92
+ if (TypeUtils.isNotNull(this.dialogClickEl)) {
93
+ this.dialogClickEl.addEventListener("click", this.onAppClick);
94
+ }
95
+ this.onResize = () => this.close();
96
+ window.addEventListener("resize", this.onResize);
97
+ },
98
+ removeOutsideListeners(appEl) {
99
+ if (TypeUtils.isFunction(this.onAppClick) && appEl) {
100
+ appEl.removeEventListener("click", this.onAppClick);
101
+ }
102
+ if (TypeUtils.isFunction(this.onAppClick) && TypeUtils.isNotNull(this.dialogClickEl)) {
103
+ this.dialogClickEl.removeEventListener("click", this.onAppClick);
104
+ }
105
+ if (TypeUtils.isFunction(this.onResize)) {
106
+ window.removeEventListener("resize", this.onResize);
107
+ }
108
+ },
109
+ resolveDialogEl() {
110
+ if (TypeUtils.isNotNull(this.reference) && TypeUtils.isFunction(this.reference.closest)) {
111
+ return this.reference.closest(".v-dialog");
112
+ }
113
+ return null;
114
+ },
115
+ handleMounted() {
116
+ const appEl = document.getElementById(APP_ID);
117
+ this.registerBusClose(appEl);
78
118
  if (!this.spec.persistent) {
79
- this.onAppClick = this.handleClose;
80
- if (appEl) {
81
- appEl.addEventListener("click", this.onAppClick);
82
- }
83
- this.onResize = () => this.close();
84
- window.addEventListener("resize", this.onResize);
119
+ this.registerOutsideListeners(appEl);
85
120
  }
86
121
  if (this.spec.overlay) {
87
122
  this.driverObj.highlight({ element: this.reference });
@@ -96,12 +131,7 @@ export default {
96
131
  }
97
132
  if (!this.spec.persistent) {
98
133
  const appEl = document.getElementById(APP_ID);
99
- if (TypeUtils.isFunction(this.onAppClick) && appEl) {
100
- appEl.removeEventListener("click", this.onAppClick);
101
- }
102
- if (TypeUtils.isFunction(this.onResize)) {
103
- window.removeEventListener("resize", this.onResize);
104
- }
134
+ this.removeOutsideListeners(appEl);
105
135
  }
106
136
  },
107
137
  handleClose(event) {
@@ -14,7 +14,10 @@ import GlibBase from "./base/glibBase.js";
14
14
  import Action from "../action";
15
15
  import { Vue } from "..";
16
16
 
17
- import VueSocialSharing from "vue-social-sharing";
17
+ import * as VueSocialSharingModule from "vue-social-sharing";
18
+ import { interopDefault } from "../utils/interop.js";
19
+
20
+ const VueSocialSharing = interopDefault(VueSocialSharingModule);
18
21
  Vue.use(VueSocialSharing, { networks: { copy: "" } });
19
22
 
20
23
  export default {
@@ -34,8 +34,11 @@ import { defineComponent, ref } from "vue";
34
34
  import * as dropUploader from "./composable/upload";
35
35
  import * as delegateUploader from "./composable/upload_delegator";
36
36
  import { watch } from "vue";
37
- import merge from 'lodash.merge';
37
+ import * as mergeModule from 'lodash.merge';
38
38
  import { useFileUtils } from "./composable/file";
39
+ import { interopDefault } from "../utils/interop.js";
40
+
41
+ const merge = interopDefault(mergeModule);
39
42
  const { signedIds } = useFileUtils();
40
43
 
41
44
  export default defineComponent({
@@ -2,14 +2,14 @@ import inputUpload from "../../components/fields/inputUpload.vue";
2
2
  import Uploader from "../../utils/glibDirectUpload";
3
3
  import { mountWithGlib, restoreUploaderStartStub, setupGlibGlobals } from "./testUtils";
4
4
 
5
- const buildSpec = (overrides: Record<string, unknown> = {}) => ({
5
+ const buildSpec = (overrides = {}) => ({
6
6
  name: "user[file]",
7
7
  label: "Upload file",
8
8
  accepts: { fileType: "txt" },
9
9
  ...overrides,
10
10
  });
11
11
 
12
- const mountComponent = (spec: Record<string, unknown>) => {
12
+ const mountComponent = (spec) => {
13
13
  mountWithGlib(inputUpload, spec);
14
14
  };
15
15
 
@@ -24,7 +24,7 @@ describe("inputUpload", () => {
24
24
 
25
25
  it("uploads via direct upload and sets hidden signed ids", () => {
26
26
  cy.stub(Uploader.prototype, "start")
27
- .callsFake((callback: (error: unknown, blob: { signed_id: string }) => void) => {
27
+ .callsFake((callback) => {
28
28
  callback(null, { signed_id: "signed-123" });
29
29
  })
30
30
  .as("directUploadStart");
@@ -2,7 +2,7 @@ import multiUpload from "../../components/fields/multiUpload.vue";
2
2
  import Uploader from "../../utils/glibDirectUpload";
3
3
  import { mountWithGlib, restoreUploaderStartStub, setupGlibGlobals } from "./testUtils";
4
4
 
5
- const buildSpec = (overrides: Record<string, unknown> = {}) => ({
5
+ const buildSpec = (overrides = {}) => ({
6
6
  name: "user[files][]",
7
7
  accepts: { fileType: "txt" },
8
8
  placeholder: "Drop files",
@@ -10,7 +10,7 @@ const buildSpec = (overrides: Record<string, unknown> = {}) => ({
10
10
  ...overrides,
11
11
  });
12
12
 
13
- const mountComponent = (spec: Record<string, unknown>) => {
13
+ const mountComponent = (spec) => {
14
14
  mountWithGlib(multiUpload, spec);
15
15
  };
16
16
 
@@ -25,7 +25,7 @@ describe("multiUpload", () => {
25
25
 
26
26
  it("uploads via direct upload and sets hidden signed ids", () => {
27
27
  cy.stub(Uploader.prototype, "start")
28
- .callsFake((callback: (error: unknown, blob: { signed_id: string }) => void) => {
28
+ .callsFake((callback) => {
29
29
  callback(null, { signed_id: "signed-123" });
30
30
  })
31
31
  .as("directUploadStart");
@@ -2,7 +2,7 @@ import placeholderUpload from "../../components/fields/placeholderUpload.vue";
2
2
  import Uploader from "../../utils/glibDirectUpload";
3
3
  import { mountWithGlib, restoreUploaderStartStub, setupGlibGlobals } from "./testUtils";
4
4
 
5
- const buildSpec = (overrides: Record<string, unknown> = {}) => ({
5
+ const buildSpec = (overrides = {}) => ({
6
6
  name: "user[file]",
7
7
  type: "image",
8
8
  width: 120,
@@ -12,7 +12,7 @@ const buildSpec = (overrides: Record<string, unknown> = {}) => ({
12
12
  ...overrides,
13
13
  });
14
14
 
15
- const mountComponent = (spec: Record<string, unknown>) => {
15
+ const mountComponent = (spec) => {
16
16
  mountWithGlib(placeholderUpload, spec);
17
17
  };
18
18
 
@@ -27,7 +27,7 @@ describe("placeholderUpload", () => {
27
27
 
28
28
  it("uploads via direct upload and sets hidden signed id", () => {
29
29
  cy.stub(Uploader.prototype, "start")
30
- .callsFake((callback: (error: unknown, blob: { signed_id: string }) => void) => {
30
+ .callsFake((callback) => {
31
31
  callback(null, { signed_id: "signed-123" });
32
32
  })
33
33
  .as("directUploadStart");
@@ -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
 
@@ -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
 
@@ -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
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl } from "../../helper"
1
+ import { testPageUrl } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('fields_creditCard')
4
4
 
@@ -1,4 +1,4 @@
1
- import { testPageUrl, withComponent } from "../../helper"
1
+ import { testPageUrl, withComponent } from "../../helper.js"
2
2
 
3
3
  const url = testPageUrl('fields_date_time')
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_dynamicSelect')
4
4