@operato/shell 10.29.44 → 10.29.45

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.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/shell",
3
3
  "description": "WebApplication architecturing shell following open-wc recommendations",
4
4
  "author": "heartyoh",
5
- "version": "10.29.44",
5
+ "version": "10.29.45",
6
6
  "type": "module",
7
7
  "main": "dist/src/index.js",
8
8
  "module": "dist/src/index.js",
@@ -103,5 +103,5 @@
103
103
  "prettier --write"
104
104
  ]
105
105
  },
106
- "gitHead": "112d3ac6ada895fc45c2010c2555d5fd88a0f8a5"
106
+ "gitHead": "665fe43472777812af4e7f6be3c64c33940b04ea"
107
107
  }
@@ -0,0 +1,46 @@
1
+ import { expect, fixture } from '@open-wc/testing'
2
+ import { html } from 'lit'
3
+ import { addressController } from '@operato/utils/address.js'
4
+
5
+ import { PageView } from '../src/app/pages/page-view.js'
6
+
7
+ /*
8
+ * A page's route arguments are compared under the claims of today. A page opened by an address with `filters`
9
+ * stores them among its arguments, because its grid claims `filters` only after it is drawn; on the next route
10
+ * dispatch they are no longer an argument. That is no change of the page's arguments - a screen that reads its list
11
+ * again on one (the Office ledgers) dropped the edits it held when the user came back from another screen.
12
+ */
13
+
14
+ class Counting extends PageView {
15
+ changed: any[] = []
16
+ async pageUpdated(changes: any) {
17
+ if (changes.params) this.changed.push(changes.params)
18
+ }
19
+ }
20
+ customElements.define('route-claims-page', Counting)
21
+
22
+ describe('route arguments and the regions claimed after a page opened', () => {
23
+ it('a key claimed by a list after the page opened is no argument change', async () => {
24
+ const path = `/route-claims-${Math.random().toString(36).slice(2)}`
25
+ history.replaceState({}, '', `${path}?filters=[1]&contract=one`)
26
+ const page = await fixture<Counting>(html`<route-claims-page></route-claims-page>`)
27
+ page.lifecycle = { active: true, params: { filters: '[1]', contract: 'one' } }
28
+ page.active = true
29
+ await page.updateComplete
30
+ await new Promise(resolve => setTimeout(resolve, 0))
31
+ page.changed = []
32
+
33
+ addressController().registerQuery(path)
34
+ page.lifecycle = { active: true, params: { contract: 'one' } }
35
+ page.requestUpdate()
36
+ await page.updateComplete
37
+ await new Promise(resolve => setTimeout(resolve, 0))
38
+ expect(page.changed).to.deep.equal([])
39
+
40
+ page.lifecycle = { active: true, params: { contract: 'two' } }
41
+ page.requestUpdate()
42
+ await page.updateComplete
43
+ await new Promise(resolve => setTimeout(resolve, 0))
44
+ expect(page.changed).to.deep.equal([{ contract: 'two' }])
45
+ })
46
+ })