@vaadin/component-base 24.4.0-alpha13 → 24.4.0-alpha14

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "24.4.0-alpha13",
3
+ "version": "24.4.0-alpha14",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,5 +42,5 @@
42
42
  "@vaadin/testing-helpers": "^0.6.0",
43
43
  "sinon": "^13.0.2"
44
44
  },
45
- "gitHead": "97246b0703cd04a4b0ea5dcd49e2581d45cf6367"
45
+ "gitHead": "303c07338b748bc6036a92a92cf1733c3bc351eb"
46
46
  }
package/src/define.js CHANGED
@@ -9,7 +9,7 @@ export function defineCustomElement(CustomElement) {
9
9
  if (!defined) {
10
10
  Object.defineProperty(CustomElement, 'version', {
11
11
  get() {
12
- return '24.4.0-alpha13';
12
+ return '24.4.0-alpha14';
13
13
  },
14
14
  });
15
15
 
@@ -5,7 +5,11 @@
5
5
  */
6
6
 
7
7
  /**
8
- * Check if two paths can be resolved as URLs
9
- * with the same origin and pathname.
8
+ * Checks if two paths match based on their origin, pathname, and query parameters.
9
+ *
10
+ * The function matches an actual URL against an expected URL to see if they share
11
+ * the same base origin (like https://example.com), the same path (like /path/to/page),
12
+ * and if the actual URL contains at least all the query parameters with the same values
13
+ * from the expected URL.
10
14
  */
11
- export declare function matchPaths(path1: string, path2: string): boolean;
15
+ export declare function matchPaths(actual: string, expected: string): boolean;
package/src/url-utils.js CHANGED
@@ -5,15 +5,37 @@
5
5
  */
6
6
 
7
7
  /**
8
- * Check if two paths can be resolved as URLs
9
- * with the same origin and pathname.
8
+ * Checks if one set of URL parameters contains all the parameters
9
+ * with the same values from another set.
10
10
  *
11
- * @param {string} path1
12
- * @param {string} path2
11
+ * @param {URLSearchParams} actual
12
+ * @param {URLSearchParams} expected
13
13
  */
14
- export function matchPaths(path1, path2) {
14
+ function containsQueryParams(actual, expected) {
15
+ return [...expected.entries()].every(([key, value]) => {
16
+ return actual.getAll(key).includes(value);
17
+ });
18
+ }
19
+
20
+ /**
21
+ * Checks if two paths match based on their origin, pathname, and query parameters.
22
+ *
23
+ * The function matches an actual URL against an expected URL to see if they share
24
+ * the same base origin (like https://example.com), the same path (like /path/to/page),
25
+ * and if the actual URL contains at least all the query parameters with the same values
26
+ * from the expected URL.
27
+ *
28
+ * @param {string} actual The actual URL to match.
29
+ * @param {string} expected The expected URL to match.
30
+ */
31
+ export function matchPaths(actual, expected) {
15
32
  const base = document.baseURI;
16
- const url1 = new URL(path1, base);
17
- const url2 = new URL(path2, base);
18
- return url1.origin === url2.origin && url1.pathname === url2.pathname;
33
+ const actualUrl = new URL(actual, base);
34
+ const expectedUrl = new URL(expected, base);
35
+
36
+ return (
37
+ actualUrl.origin === expectedUrl.origin &&
38
+ actualUrl.pathname === expectedUrl.pathname &&
39
+ containsQueryParams(actualUrl.searchParams, expectedUrl.searchParams)
40
+ );
19
41
  }
@@ -234,6 +234,7 @@ export class IronListAdapter {
234
234
  // Clean up temporary placeholder sizing
235
235
  if (el.__virtualizerPlaceholder) {
236
236
  el.style.paddingTop = '';
237
+ el.style.opacity = '';
237
238
  el.__virtualizerPlaceholder = false;
238
239
  }
239
240
 
@@ -258,6 +259,7 @@ export class IronListAdapter {
258
259
  // Assign a temporary placeholder sizing to elements that would otherwise end up having
259
260
  // no height.
260
261
  el.style.paddingTop = `${this.__placeholderHeight}px`;
262
+ el.style.opacity = '0';
261
263
  el.__virtualizerPlaceholder = true;
262
264
 
263
265
  // Manually schedule the resize handler to make sure the placeholder padding is