@dhis2-ui/alert 9.4.3 → 9.4.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.
- package/build/cjs/alert-bar/alert-bar.js +8 -1
- package/build/cjs/alert-bar/features/api/index.js +15 -13
- package/build/cjs/alert-bar/features/common/index.js +6 -6
- package/build/cjs/alert-bar/features/hide/index.js +13 -18
- package/build/cjs/alert-stack/features/render_children/alertbars.js +3 -3
- package/build/es/alert-bar/alert-bar.js +8 -1
- package/build/es/alert-bar/features/api/index.js +5 -2
- package/build/es/alert-bar/features/common/index.js +1 -1
- package/build/es/alert-bar/features/hide/index.js +9 -13
- package/build/es/alert-stack/features/render_children/alertbars.js +1 -1
- package/package.json +4 -4
- package/build/cjs/alert-bar/features/api/hidden_callback.js +0 -19
- package/build/cjs/alert-bar/features/api/prop_message.js +0 -37
- package/build/cjs/alert-bar/features/api/props_message.js +0 -12
- package/build/cjs/alert-bar/features/api/props_permanent.js +0 -13
- package/build/cjs/alert-bar/features/hide/automatically.js +0 -16
- package/build/cjs/alert-bar/features/hide/on_action.js +0 -13
- package/build/es/alert-bar/features/api/hidden_callback.js +0 -15
- package/build/es/alert-bar/features/api/prop_message.js +0 -33
- package/build/es/alert-bar/features/api/props_message.js +0 -8
- package/build/es/alert-bar/features/api/props_permanent.js +0 -9
- package/build/es/alert-bar/features/hide/automatically.js +0 -12
- package/build/es/alert-bar/features/hide/on_action.js +0 -9
@@ -165,7 +165,8 @@ AlertBar.defaultProps = {
|
|
165
165
|
icon: true
|
166
166
|
};
|
167
167
|
AlertBar.propTypes = {
|
168
|
-
/** An array of 0-2 action objects
|
168
|
+
/** An array of 0-2 action objects
|
169
|
+
`[{label: "Save", onClick: clickHandler}]`*/
|
169
170
|
actions: _actions.actionsPropType,
|
170
171
|
|
171
172
|
/** The message string for the alert */
|
@@ -175,7 +176,11 @@ AlertBar.propTypes = {
|
|
175
176
|
/** Alert bars with `critical` will not autohide */
|
176
177
|
critical: alertTypePropType,
|
177
178
|
dataTest: _propTypes2.default.string,
|
179
|
+
|
180
|
+
/** How long you want the notification to display, in `ms`, when it's not permanent */
|
178
181
|
duration: _propTypes2.default.number,
|
182
|
+
|
183
|
+
/** AlertBar will be hidden on creation when this is set to true */
|
179
184
|
hidden: _propTypes2.default.bool,
|
180
185
|
|
181
186
|
/**
|
@@ -183,6 +188,8 @@ AlertBar.propTypes = {
|
|
183
188
|
* If `false` is provided, no icon will be shown.
|
184
189
|
*/
|
185
190
|
icon: _icon.iconPropType,
|
191
|
+
|
192
|
+
/** When set, AlertBar will not autohide */
|
186
193
|
permanent: _propTypes2.default.bool,
|
187
194
|
success: alertTypePropType,
|
188
195
|
|
@@ -1,37 +1,39 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
require("
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
(0, _steps.Given)('an AlertBar with onHidden handler is rendered', () => {
|
5
|
+
(0, _cypressCucumberPreprocessor.Given)('an AlertBar with onHidden handler is rendered', () => {
|
8
6
|
cy.visitStory('AlertBar', 'With onHidden');
|
9
7
|
});
|
10
|
-
(0,
|
8
|
+
(0, _cypressCucumberPreprocessor.Given)('an AlertBar with disabled icon is rendered', () => {
|
11
9
|
cy.visitStory('AlertBar', 'Disabled icon');
|
12
10
|
});
|
13
|
-
(0,
|
11
|
+
(0, _cypressCucumberPreprocessor.Given)('an AlertBar with custom icon is rendered', () => {
|
14
12
|
cy.visitStory('AlertBar', 'Custom icon');
|
15
13
|
});
|
16
|
-
(0,
|
14
|
+
(0, _cypressCucumberPreprocessor.Given)('an AlertBar with a message is rendered', () => {
|
17
15
|
cy.visitStory('AlertBar', 'With message');
|
18
16
|
});
|
19
|
-
(0,
|
17
|
+
(0, _cypressCucumberPreprocessor.Given)('an AlertBar with permanent is rendered', () => {
|
20
18
|
cy.visitStory('AlertBar', 'Permanent');
|
21
19
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
22
20
|
});
|
23
|
-
(0,
|
21
|
+
(0, _cypressCucumberPreprocessor.When)('the Alertbar is not rendered', () => {
|
22
|
+
cy.wait(8000);
|
23
|
+
cy.get('[data-test="dhis2-uicore-alertbar"]').should('not.exist');
|
24
|
+
});
|
25
|
+
(0, _cypressCucumberPreprocessor.Then)('the icon will be visible', () => {
|
24
26
|
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').should('be.visible');
|
25
27
|
});
|
26
|
-
(0,
|
28
|
+
(0, _cypressCucumberPreprocessor.Then)('the icon will not be rendered', () => {
|
27
29
|
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').should('not.exist');
|
28
30
|
});
|
29
|
-
(0,
|
31
|
+
(0, _cypressCucumberPreprocessor.Then)('the custom icon will be visible', () => {
|
30
32
|
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').contains('Custom icon').should('be.visible');
|
31
33
|
});
|
32
|
-
(0,
|
34
|
+
(0, _cypressCucumberPreprocessor.Then)('the message will be visible', () => {
|
33
35
|
cy.get('[data-test="dhis2-uicore-alertbar"]').contains('With a message').should('be.visible');
|
34
36
|
});
|
35
|
-
(0,
|
37
|
+
(0, _cypressCucumberPreprocessor.Then)('the AlertBar will be visible', () => {
|
36
38
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
37
39
|
});
|
@@ -1,22 +1,22 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
4
4
|
|
5
|
-
(0,
|
5
|
+
(0, _cypressCucumberPreprocessor.Given)('a default AlertBar is rendered', () => {
|
6
6
|
cy.visitStory('AlertBar', 'Default');
|
7
7
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
8
8
|
});
|
9
|
-
(0,
|
9
|
+
(0, _cypressCucumberPreprocessor.Given)('the AlertBar is rendered', () => {
|
10
10
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('exist');
|
11
11
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
12
12
|
});
|
13
|
-
(0,
|
13
|
+
(0, _cypressCucumberPreprocessor.Then)('the AlertBar is not rendered', () => {
|
14
14
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('not.exist');
|
15
15
|
});
|
16
|
-
(0,
|
16
|
+
(0, _cypressCucumberPreprocessor.When)('the default duration has passed', () => {
|
17
17
|
cy.wait(8000);
|
18
18
|
});
|
19
|
-
(0,
|
19
|
+
(0, _cypressCucumberPreprocessor.Then)('the onHidden handler is called', () => {
|
20
20
|
cy.window().should(win => {
|
21
21
|
expect(win.onHidden).to.be.calledOnce;
|
22
22
|
expect(win.onHidden).to.be.calledWith({}, null);
|
@@ -1,34 +1,29 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
require("
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
(0, _cypressCucumberPreprocessor.Given)('a permanent AlertBar with hidden and onHidden is rendered', () => {
|
6
|
+
cy.visitStory('AlertBar', 'Hidden prop');
|
7
|
+
});
|
8
|
+
(0, _cypressCucumberPreprocessor.Given)('an AlertBar with a custom duration is rendered', () => {
|
8
9
|
cy.visitStory('AlertBar', 'Custom duration');
|
9
10
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
10
11
|
});
|
11
|
-
(0,
|
12
|
+
(0, _cypressCucumberPreprocessor.Given)('a permanent AlertBar with actions is rendered', () => {
|
12
13
|
cy.visitStory('AlertBar', 'Permanent with actions');
|
13
14
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
14
15
|
});
|
15
|
-
(0,
|
16
|
-
cy.
|
17
|
-
});
|
18
|
-
(0, _steps.When)('the custom duration has passed', () => {
|
19
|
-
cy.wait(2000);
|
16
|
+
(0, _cypressCucumberPreprocessor.When)('the user clicks on the "Cancel" button', () => {
|
17
|
+
cy.get('[data-test="dhis2-uicore-alertbar-action"]:contains("Cancel")').click();
|
20
18
|
});
|
21
|
-
(0,
|
22
|
-
cy.
|
19
|
+
(0, _cypressCucumberPreprocessor.When)('the user click a button which toggles the hidden prop', () => {
|
20
|
+
cy.get('button').click();
|
23
21
|
});
|
24
|
-
(0,
|
25
|
-
cy.
|
22
|
+
(0, _cypressCucumberPreprocessor.When)('the custom duration has passed', () => {
|
23
|
+
cy.wait(2000);
|
26
24
|
});
|
27
|
-
(0,
|
25
|
+
(0, _cypressCucumberPreprocessor.Then)('the onHidden handler is not called', () => {
|
28
26
|
cy.window().should(win => {
|
29
27
|
expect(win.onHidden).to.not.be.called;
|
30
28
|
});
|
31
|
-
});
|
32
|
-
(0, _steps.When)('the user click a button which toggles the hidden prop', () => {
|
33
|
-
cy.get('button').click();
|
34
29
|
});
|
@@ -1,12 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var
|
3
|
+
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
4
4
|
|
5
|
-
(0,
|
5
|
+
(0, _cypressCucumberPreprocessor.Given)('an AlertStack with multiple AlertBars is rendered', () => {
|
6
6
|
cy.visitStory('Alertstack', 'Default');
|
7
7
|
cy.get('[data-test="dhis2-uicore-alertstack"]').should('be.visible');
|
8
8
|
});
|
9
|
-
(0,
|
9
|
+
(0, _cypressCucumberPreprocessor.Then)('the AlertBars will be visible', () => {
|
10
10
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('have.length', 3);
|
11
11
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
12
12
|
});
|
@@ -142,7 +142,8 @@ AlertBar.defaultProps = {
|
|
142
142
|
icon: true
|
143
143
|
};
|
144
144
|
AlertBar.propTypes = {
|
145
|
-
/** An array of 0-2 action objects
|
145
|
+
/** An array of 0-2 action objects
|
146
|
+
`[{label: "Save", onClick: clickHandler}]`*/
|
146
147
|
actions: actionsPropType,
|
147
148
|
|
148
149
|
/** The message string for the alert */
|
@@ -152,7 +153,11 @@ AlertBar.propTypes = {
|
|
152
153
|
/** Alert bars with `critical` will not autohide */
|
153
154
|
critical: alertTypePropType,
|
154
155
|
dataTest: PropTypes.string,
|
156
|
+
|
157
|
+
/** How long you want the notification to display, in `ms`, when it's not permanent */
|
155
158
|
duration: PropTypes.number,
|
159
|
+
|
160
|
+
/** AlertBar will be hidden on creation when this is set to true */
|
156
161
|
hidden: PropTypes.bool,
|
157
162
|
|
158
163
|
/**
|
@@ -160,6 +165,8 @@ AlertBar.propTypes = {
|
|
160
165
|
* If `false` is provided, no icon will be shown.
|
161
166
|
*/
|
162
167
|
icon: iconPropType,
|
168
|
+
|
169
|
+
/** When set, AlertBar will not autohide */
|
163
170
|
permanent: PropTypes.bool,
|
164
171
|
success: alertTypePropType,
|
165
172
|
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import '
|
2
|
-
import { Given, Then } from 'cypress-cucumber-preprocessor/steps';
|
1
|
+
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
3
2
|
Given('an AlertBar with onHidden handler is rendered', () => {
|
4
3
|
cy.visitStory('AlertBar', 'With onHidden');
|
5
4
|
});
|
@@ -16,6 +15,10 @@ Given('an AlertBar with permanent is rendered', () => {
|
|
16
15
|
cy.visitStory('AlertBar', 'Permanent');
|
17
16
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
18
17
|
});
|
18
|
+
When('the Alertbar is not rendered', () => {
|
19
|
+
cy.wait(8000);
|
20
|
+
cy.get('[data-test="dhis2-uicore-alertbar"]').should('not.exist');
|
21
|
+
});
|
19
22
|
Then('the icon will be visible', () => {
|
20
23
|
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').should('be.visible');
|
21
24
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { When, Given, Then } from 'cypress-cucumber-preprocessor
|
1
|
+
import { When, Given, Then } from '@badeball/cypress-cucumber-preprocessor';
|
2
2
|
Given('a default AlertBar is rendered', () => {
|
3
3
|
cy.visitStory('AlertBar', 'Default');
|
4
4
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
@@ -1,5 +1,7 @@
|
|
1
|
-
import '
|
2
|
-
|
1
|
+
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
2
|
+
Given('a permanent AlertBar with hidden and onHidden is rendered', () => {
|
3
|
+
cy.visitStory('AlertBar', 'Hidden prop');
|
4
|
+
});
|
3
5
|
Given('an AlertBar with a custom duration is rendered', () => {
|
4
6
|
cy.visitStory('AlertBar', 'Custom duration');
|
5
7
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
@@ -8,23 +10,17 @@ Given('a permanent AlertBar with actions is rendered', () => {
|
|
8
10
|
cy.visitStory('AlertBar', 'Permanent with actions');
|
9
11
|
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
10
12
|
});
|
11
|
-
|
12
|
-
cy.
|
13
|
+
When('the user clicks on the "Cancel" button', () => {
|
14
|
+
cy.get('[data-test="dhis2-uicore-alertbar-action"]:contains("Cancel")').click();
|
15
|
+
});
|
16
|
+
When('the user click a button which toggles the hidden prop', () => {
|
17
|
+
cy.get('button').click();
|
13
18
|
});
|
14
19
|
When('the custom duration has passed', () => {
|
15
20
|
cy.wait(2000);
|
16
21
|
});
|
17
|
-
When('the default duration has passed', () => {
|
18
|
-
cy.wait(8000);
|
19
|
-
});
|
20
|
-
When('the user clicks on the "Cancel" button', () => {
|
21
|
-
cy.get('[data-test="dhis2-uicore-alertbar-action"]:contains("Cancel")').click();
|
22
|
-
});
|
23
22
|
Then('the onHidden handler is not called', () => {
|
24
23
|
cy.window().should(win => {
|
25
24
|
expect(win.onHidden).to.not.be.called;
|
26
25
|
});
|
27
|
-
});
|
28
|
-
When('the user click a button which toggles the hidden prop', () => {
|
29
|
-
cy.get('button').click();
|
30
26
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Given, Then } from 'cypress-cucumber-preprocessor
|
1
|
+
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
|
2
2
|
Given('an AlertStack with multiple AlertBars is rendered', () => {
|
3
3
|
cy.visitStory('Alertstack', 'Default');
|
4
4
|
cy.get('[data-test="dhis2-uicore-alertstack"]').should('be.visible');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dhis2-ui/alert",
|
3
|
-
"version": "9.4.
|
3
|
+
"version": "9.4.5",
|
4
4
|
"description": "UI Alert",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -33,9 +33,9 @@
|
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
35
|
"@dhis2/prop-types": "^3.1.2",
|
36
|
-
"@dhis2-ui/portal": "9.4.
|
37
|
-
"@dhis2/ui-constants": "9.4.
|
38
|
-
"@dhis2/ui-icons": "9.4.
|
36
|
+
"@dhis2-ui/portal": "9.4.5",
|
37
|
+
"@dhis2/ui-constants": "9.4.5",
|
38
|
+
"@dhis2/ui-icons": "9.4.5",
|
39
39
|
"classnames": "^2.3.1",
|
40
40
|
"prop-types": "^15.7.2"
|
41
41
|
},
|
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
require("../common/index.js");
|
4
|
-
|
5
|
-
var _steps = require("cypress-cucumber-preprocessor/steps");
|
6
|
-
|
7
|
-
(0, _steps.Given)('an Alertbar with onHidden handler is rendered', () => {
|
8
|
-
cy.visitStory('Alertbar', 'With onHidden');
|
9
|
-
});
|
10
|
-
(0, _steps.When)('the Alertbar is not rendered', () => {
|
11
|
-
cy.wait(8000);
|
12
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('not.exist');
|
13
|
-
});
|
14
|
-
(0, _steps.Then)('the onHidden handler is called', () => {
|
15
|
-
cy.window().should(win => {
|
16
|
-
expect(win.onHidden).to.be.calledOnce;
|
17
|
-
expect(win.onHidden).to.be.calledWith({}, null);
|
18
|
-
});
|
19
|
-
});
|
@@ -1,37 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
require("../common/index.js");
|
4
|
-
|
5
|
-
var _steps = require("cypress-cucumber-preprocessor/steps");
|
6
|
-
|
7
|
-
(0, _steps.Given)('an AlertBar with onHidden handler is rendered', () => {
|
8
|
-
cy.visitStory('AlertBar', 'With onHidden');
|
9
|
-
});
|
10
|
-
(0, _steps.Given)('an AlertBar with disabled icon is rendered', () => {
|
11
|
-
cy.visitStory('AlertBar', 'Disabled icon');
|
12
|
-
});
|
13
|
-
(0, _steps.Given)('an AlertBar with custom icon is rendered', () => {
|
14
|
-
cy.visitStory('AlertBar', 'Custom icon');
|
15
|
-
});
|
16
|
-
(0, _steps.Given)('an AlertBar with a message is rendered', () => {
|
17
|
-
cy.visitStory('AlertBar', 'With message');
|
18
|
-
});
|
19
|
-
(0, _steps.Given)('an AlertBar with permanent is rendered', () => {
|
20
|
-
cy.visitStory('AlertBar', 'Permanent');
|
21
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
22
|
-
});
|
23
|
-
(0, _steps.Then)('the icon will be visible', () => {
|
24
|
-
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').should('be.visible');
|
25
|
-
});
|
26
|
-
(0, _steps.Then)('the icon will not be rendered', () => {
|
27
|
-
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').should('not.exist');
|
28
|
-
});
|
29
|
-
(0, _steps.Then)('the custom icon will be visible', () => {
|
30
|
-
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').contains('Custom icon').should('be.visible');
|
31
|
-
});
|
32
|
-
(0, _steps.Then)('the message will be visible', () => {
|
33
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').contains('With a message').should('be.visible');
|
34
|
-
});
|
35
|
-
(0, _steps.Then)('the AlertBar will be visible', () => {
|
36
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
37
|
-
});
|
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
require("../common/index.js");
|
4
|
-
|
5
|
-
var _steps = require("cypress-cucumber-preprocessor/steps");
|
6
|
-
|
7
|
-
(0, _steps.Given)('an AlertBar with a message is rendered', () => {
|
8
|
-
cy.visitStory('AlertBar', 'With message');
|
9
|
-
});
|
10
|
-
(0, _steps.Then)('the message will be visible', () => {
|
11
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').contains('With a message').should('be.visible');
|
12
|
-
});
|
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
require("../common/index.js");
|
4
|
-
|
5
|
-
var _steps = require("cypress-cucumber-preprocessor/steps");
|
6
|
-
|
7
|
-
(0, _steps.Given)('an AlertBar with permanent is rendered', () => {
|
8
|
-
cy.visitStory('AlertBar', 'Permanent');
|
9
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
10
|
-
});
|
11
|
-
(0, _steps.Then)('the AlertBar will be visible', () => {
|
12
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
13
|
-
});
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
require("../common/index.js");
|
4
|
-
|
5
|
-
var _steps = require("cypress-cucumber-preprocessor/steps");
|
6
|
-
|
7
|
-
(0, _steps.Given)('an AlertBar with a custom duration is rendered', () => {
|
8
|
-
cy.visitStory('AlertBar', 'Custom duration');
|
9
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
10
|
-
});
|
11
|
-
(0, _steps.When)('the custom duration has passed', () => {
|
12
|
-
cy.wait(2000);
|
13
|
-
});
|
14
|
-
(0, _steps.When)('the default duration has passed', () => {
|
15
|
-
cy.wait(8000);
|
16
|
-
});
|
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
require("../common/index.js");
|
4
|
-
|
5
|
-
var _steps = require("cypress-cucumber-preprocessor/steps");
|
6
|
-
|
7
|
-
(0, _steps.Given)('a permanent AlertBar with actions is rendered', () => {
|
8
|
-
cy.visitStory('AlertBar', 'Permanent with actions');
|
9
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
10
|
-
});
|
11
|
-
(0, _steps.When)('the user clicks on the "Cancel" button', () => {
|
12
|
-
cy.get('[data-test="dhis2-uicore-alertbar-action"]:contains("Cancel")').click();
|
13
|
-
});
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import '../common/index.js';
|
2
|
-
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
|
3
|
-
Given('an Alertbar with onHidden handler is rendered', () => {
|
4
|
-
cy.visitStory('Alertbar', 'With onHidden');
|
5
|
-
});
|
6
|
-
When('the Alertbar is not rendered', () => {
|
7
|
-
cy.wait(8000);
|
8
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('not.exist');
|
9
|
-
});
|
10
|
-
Then('the onHidden handler is called', () => {
|
11
|
-
cy.window().should(win => {
|
12
|
-
expect(win.onHidden).to.be.calledOnce;
|
13
|
-
expect(win.onHidden).to.be.calledWith({}, null);
|
14
|
-
});
|
15
|
-
});
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import '../common/index.js';
|
2
|
-
import { Given, Then } from 'cypress-cucumber-preprocessor/steps';
|
3
|
-
Given('an AlertBar with onHidden handler is rendered', () => {
|
4
|
-
cy.visitStory('AlertBar', 'With onHidden');
|
5
|
-
});
|
6
|
-
Given('an AlertBar with disabled icon is rendered', () => {
|
7
|
-
cy.visitStory('AlertBar', 'Disabled icon');
|
8
|
-
});
|
9
|
-
Given('an AlertBar with custom icon is rendered', () => {
|
10
|
-
cy.visitStory('AlertBar', 'Custom icon');
|
11
|
-
});
|
12
|
-
Given('an AlertBar with a message is rendered', () => {
|
13
|
-
cy.visitStory('AlertBar', 'With message');
|
14
|
-
});
|
15
|
-
Given('an AlertBar with permanent is rendered', () => {
|
16
|
-
cy.visitStory('AlertBar', 'Permanent');
|
17
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
18
|
-
});
|
19
|
-
Then('the icon will be visible', () => {
|
20
|
-
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').should('be.visible');
|
21
|
-
});
|
22
|
-
Then('the icon will not be rendered', () => {
|
23
|
-
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').should('not.exist');
|
24
|
-
});
|
25
|
-
Then('the custom icon will be visible', () => {
|
26
|
-
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').contains('Custom icon').should('be.visible');
|
27
|
-
});
|
28
|
-
Then('the message will be visible', () => {
|
29
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').contains('With a message').should('be.visible');
|
30
|
-
});
|
31
|
-
Then('the AlertBar will be visible', () => {
|
32
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
33
|
-
});
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import '../common/index.js';
|
2
|
-
import { Given, Then } from 'cypress-cucumber-preprocessor/steps';
|
3
|
-
Given('an AlertBar with a message is rendered', () => {
|
4
|
-
cy.visitStory('AlertBar', 'With message');
|
5
|
-
});
|
6
|
-
Then('the message will be visible', () => {
|
7
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').contains('With a message').should('be.visible');
|
8
|
-
});
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import '../common/index.js';
|
2
|
-
import { Given, Then } from 'cypress-cucumber-preprocessor/steps';
|
3
|
-
Given('an AlertBar with permanent is rendered', () => {
|
4
|
-
cy.visitStory('AlertBar', 'Permanent');
|
5
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
6
|
-
});
|
7
|
-
Then('the AlertBar will be visible', () => {
|
8
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
9
|
-
});
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import '../common/index.js';
|
2
|
-
import { Given, When } from 'cypress-cucumber-preprocessor/steps';
|
3
|
-
Given('an AlertBar with a custom duration is rendered', () => {
|
4
|
-
cy.visitStory('AlertBar', 'Custom duration');
|
5
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
6
|
-
});
|
7
|
-
When('the custom duration has passed', () => {
|
8
|
-
cy.wait(2000);
|
9
|
-
});
|
10
|
-
When('the default duration has passed', () => {
|
11
|
-
cy.wait(8000);
|
12
|
-
});
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import '../common/index.js';
|
2
|
-
import { Given, When } from 'cypress-cucumber-preprocessor/steps';
|
3
|
-
Given('a permanent AlertBar with actions is rendered', () => {
|
4
|
-
cy.visitStory('AlertBar', 'Permanent with actions');
|
5
|
-
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible');
|
6
|
-
});
|
7
|
-
When('the user clicks on the "Cancel" button', () => {
|
8
|
-
cy.get('[data-test="dhis2-uicore-alertbar-action"]:contains("Cancel")').click();
|
9
|
-
});
|