@dile/ui 3.6.5 → 3.6.6
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.
|
@@ -29,4 +29,29 @@ describe('dile-confirm', () => {
|
|
|
29
29
|
|
|
30
30
|
expect(accepted).toBe(true);
|
|
31
31
|
});
|
|
32
|
+
|
|
33
|
+
it('handles dontCloseOnAccept and can be reset with resetProcessing()', async () => {
|
|
34
|
+
const el = await renderConfirm('<dile-confirm dontCloseOnAccept>Are you sure?</dile-confirm>');
|
|
35
|
+
let acceptCount = 0;
|
|
36
|
+
el.addEventListener('dile-confirm-accepted', () => { acceptCount++; });
|
|
37
|
+
|
|
38
|
+
el.shadowRoot.querySelector('.accept').click();
|
|
39
|
+
await el.updateComplete;
|
|
40
|
+
expect(acceptCount).toBe(1);
|
|
41
|
+
expect(el._isProcessing).toBe(true);
|
|
42
|
+
expect(el.shadowRoot.querySelector('.accept').classList.contains('disabled')).toBe(true);
|
|
43
|
+
|
|
44
|
+
// Clicking again while processing should not trigger accept
|
|
45
|
+
el.shadowRoot.querySelector('.accept').click();
|
|
46
|
+
expect(acceptCount).toBe(1);
|
|
47
|
+
|
|
48
|
+
// Calling resetProcessing should unlock the buttons
|
|
49
|
+
el.resetProcessing();
|
|
50
|
+
await el.updateComplete;
|
|
51
|
+
expect(el._isProcessing).toBe(false);
|
|
52
|
+
expect(el.shadowRoot.querySelector('.accept').classList.contains('disabled')).toBe(false);
|
|
53
|
+
|
|
54
|
+
el.shadowRoot.querySelector('.accept').click();
|
|
55
|
+
expect(acceptCount).toBe(2);
|
|
56
|
+
});
|
|
32
57
|
});
|
|
@@ -52,6 +52,7 @@ export class DileConfirm extends LitElement {
|
|
|
52
52
|
cancelLabel: { type: String },
|
|
53
53
|
blocking: { type: Boolean },
|
|
54
54
|
dontCloseOnAccept: { type: Boolean },
|
|
55
|
+
_isProcessing: { state: true },
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -61,6 +62,7 @@ export class DileConfirm extends LitElement {
|
|
|
61
62
|
this.cancelLabel = "Cancell";
|
|
62
63
|
this.opened = false;
|
|
63
64
|
this.blocking = false;
|
|
65
|
+
this.dontCloseOnAccept = false;
|
|
64
66
|
this._isProcessing = false;
|
|
65
67
|
}
|
|
66
68
|
|
|
@@ -100,6 +102,7 @@ export class DileConfirm extends LitElement {
|
|
|
100
102
|
|
|
101
103
|
open() {
|
|
102
104
|
this.modal.open();
|
|
105
|
+
this._isProcessing = false;
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
close() {
|
|
@@ -107,6 +110,10 @@ export class DileConfirm extends LitElement {
|
|
|
107
110
|
this._isProcessing = false;
|
|
108
111
|
}
|
|
109
112
|
|
|
113
|
+
resetProcessing() {
|
|
114
|
+
this._isProcessing = false;
|
|
115
|
+
}
|
|
116
|
+
|
|
110
117
|
firstUpdated() {
|
|
111
118
|
this.modal = this.shadowRoot.getElementById("modal");
|
|
112
119
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/ui",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.6",
|
|
4
4
|
"description": "UI Core components from dile-components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "3bc0a2459a5ced3e7105ce061f93f07a9c798759"
|
|
32
32
|
}
|