@kubex/zinc 1.1.147 → 1.1.148
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/dist/chunks/zn.ESPCJQBM.js +4 -0
- package/dist/custom-elements.json +18 -1
- package/dist/vscode.html-custom-data.json +1 -0
- package/dist/web-types.json +117 -112
- package/dist/zn.d.ts +1 -0
- package/dist/zn.min.js +323 -318
- package/package.json +1 -1
- package/src/components/confirm/confirm.component.ts +12 -6
- package/src/components/confirm/confirm.test.ts +14 -3
- package/dist/chunks/zn.SBAUMVLL.js +0 -4
package/package.json
CHANGED
|
@@ -70,6 +70,8 @@ export default class ZnConfirm extends ZincElement {
|
|
|
70
70
|
|
|
71
71
|
@property() cancelText: string = "Cancel";
|
|
72
72
|
|
|
73
|
+
@property() closeText: string = "Close";
|
|
74
|
+
|
|
73
75
|
@property({type: Boolean, attribute: 'hide-icon'}) hideIcon: boolean = false;
|
|
74
76
|
|
|
75
77
|
/**
|
|
@@ -228,12 +230,16 @@ export default class ZnConfirm extends ZincElement {
|
|
|
228
230
|
<slot></slot>`}
|
|
229
231
|
</div>
|
|
230
232
|
|
|
231
|
-
|
|
232
|
-
${this.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
${this.
|
|
236
|
-
|
|
233
|
+
${this.failed ? html`
|
|
234
|
+
<zn-button color="${this.type}" slot="footer" dialog-closer>
|
|
235
|
+
${this.closeText}
|
|
236
|
+
</zn-button>` : html`
|
|
237
|
+
<zn-button outline color="${this.type}" slot="footer" dialog-closer disabled=${this.loading || nothing}>
|
|
238
|
+
${this.cancelText}
|
|
239
|
+
</zn-button>
|
|
240
|
+
<zn-button color="${this.type}" slot="footer" @click="${this.submitDialog}" disabled=${this.loading || nothing}>
|
|
241
|
+
${this.confirmText}
|
|
242
|
+
</zn-button>`}
|
|
237
243
|
|
|
238
244
|
<slot name="footer-text" slot="footer-text">${this.footerText}</slot>
|
|
239
245
|
</zn-dialog>`;
|
|
@@ -28,7 +28,7 @@ async function submittedConfirm() {
|
|
|
28
28
|
click(buttons[1]);
|
|
29
29
|
await (confirm as never as {updateComplete: Promise<void>}).updateComplete;
|
|
30
30
|
|
|
31
|
-
return {confirm, form, dialog
|
|
31
|
+
return {confirm, form, dialog};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const closer = (dialog: Element) => dialog.shadowRoot!.querySelector('.dialog__close')!;
|
|
@@ -62,7 +62,7 @@ describe('<zn-confirm-modal>', () => {
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
it('reports failure when the response carries a danger alert', async () => {
|
|
65
|
-
const {confirm, form, dialog
|
|
65
|
+
const {confirm, form, dialog} = await submittedConfirm();
|
|
66
66
|
|
|
67
67
|
settle(form, 'complete', {
|
|
68
68
|
response: {status: 200, actions: [{action: 'alert', style: 'error', title: 'Deployment stopped'}]}
|
|
@@ -72,10 +72,21 @@ describe('<zn-confirm-modal>', () => {
|
|
|
72
72
|
expect(confirm.shadowRoot!.textContent).to.contain('Failed');
|
|
73
73
|
expect(confirm.shadowRoot!.textContent).to.contain('Deployment stopped');
|
|
74
74
|
expect(confirm.shadowRoot!.textContent).to.not.contain('Loading');
|
|
75
|
-
expect(cancel.disabled).to.be.false;
|
|
76
75
|
expect(closer(dialog).disabled).to.be.false;
|
|
77
76
|
});
|
|
78
77
|
|
|
78
|
+
it('offers only a close button once the request has failed', async () => {
|
|
79
|
+
const {confirm, form} = await submittedConfirm();
|
|
80
|
+
|
|
81
|
+
settle(form, 'error', {});
|
|
82
|
+
await (confirm as never as {updateComplete: Promise<void>}).updateComplete;
|
|
83
|
+
|
|
84
|
+
const buttons = confirm.shadowRoot!.querySelectorAll('zn-button[slot="footer"]');
|
|
85
|
+
expect(buttons.length).to.equal(1);
|
|
86
|
+
expect(buttons[0].textContent!.trim()).to.equal('Close');
|
|
87
|
+
expect(buttons[0].hasAttribute('dialog-closer')).to.be.true;
|
|
88
|
+
});
|
|
89
|
+
|
|
79
90
|
it('reports failure when the request errors', async () => {
|
|
80
91
|
const {confirm, form, dialog} = await submittedConfirm();
|
|
81
92
|
|