@dhis2-ui/header-bar 9.10.3 → 9.11.1-beta.1
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/__e2e__/{header-bar.stories.e2e.js → header-bar.e2e.stories.js} +2 -20
- package/build/cjs/__e2e__/stories/common.js +12 -33
- package/build/cjs/__e2e__/stories/custom-application-title.js +3 -8
- package/build/cjs/__e2e__/stories/default.js +1 -7
- package/build/cjs/__e2e__/stories/me-with-avatar.js +3 -8
- package/build/cjs/__e2e__/stories/modulesWithSpecialCharacters.js +2 -3
- package/build/cjs/__e2e__/stories/online-status-message.js +4 -14
- package/build/cjs/__e2e__/stories/pwa-enabled.js +3 -8
- package/build/cjs/__e2e__/stories/user-has-all-authority.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-no-authorities.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-web-interpretation-and-messaging-authority.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-web-interpretation-authority.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-web-messaging-authority.js +5 -9
- package/build/cjs/__e2e__/stories/with-debug-info-edge-cases.js +11 -18
- package/build/cjs/__e2e__/stories/with-special-app-name-character.js +5 -9
- package/build/cjs/__e2e__/stories/with-update-available-notification.js +6 -13
- package/build/cjs/__e2e__/stories/zero-unread-interpretations.js +3 -8
- package/build/cjs/__e2e__/stories/zero-unread-messages.js +3 -8
- package/build/cjs/apps.js +9 -34
- package/build/cjs/debug-info/debug-info-menu-item.js +4 -17
- package/build/cjs/debug-info/debug-info-modal.js +2 -15
- package/build/cjs/debug-info/debug-info-table.js +2 -9
- package/build/cjs/debug-info/use-debug-info.js +0 -5
- package/build/cjs/features/common/index.js +3 -7
- package/build/cjs/features/the_headerbar_can_display_online_status/the_headerbar_displays_online_status.js +9 -5
- package/build/cjs/features/the_headerbar_conditionally_renders_notification_icons/the_headerbar_conditionally_renders_notification_icons.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/common.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/the_app_menu_closes_when_the_user_clicks_outside.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/the_headerbar_contains_a_menu_icon.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/the_user_will_be_offered_a_menu_with_5_apps.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/common.js +4 -2
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_a_text_icon_if_the_user_does_not_have_an_avatar.js +2 -3
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_an_image_icon_if_the_user_has_an_avatar.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_menu_opens.js +4 -2
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_profile_menu_closes_when_the_user_clicks_outside.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_edit_his_profile.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_his_account.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_about_dhis2_page.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_help_page.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_settings.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_log_out.js +16 -14
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_name_and_email_are_displayed.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/the_headerbar_displays_a_link_to_the_interpretations.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/there_are_no_unread_interpretations.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/there_are_some_unread_interpretations.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/the_headerbar_displays_a_link_to_the_messages.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/there_are_no_unread_messages.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/there_are_some_unread_messages.js +0 -1
- package/build/cjs/features/the_headerbar_should_contain_a_logo_that_links_to_the_homepage/headerbar_contains_logo.js +0 -2
- package/build/cjs/features/the_headerbar_should_display_app_update_notification/index.js +0 -1
- package/build/cjs/features/the_headerbar_should_display_debug_version_infos/index.js +0 -1
- package/build/cjs/features/the_headerbar_should_display_the_title_provided_by_the_backend_and_the_app/the_headerbar_displays_the_custom_title.js +0 -1
- package/build/cjs/features/the_search_should_escape_regexp_character/common.js +0 -1
- package/build/cjs/features/the_search_should_escape_regexp_character/the_modules_do_not_contain_items_with_special_chars.js +0 -1
- package/build/cjs/features/the_search_should_escape_regexp_character/the_user_searches_for_an_app_with_a_regex_character.js +2 -4
- package/build/cjs/header-bar-context.js +3 -13
- package/build/cjs/header-bar.js +8 -31
- package/build/cjs/{header-bar.stories.js → header-bar.prod.stories.js} +33 -40
- package/build/cjs/index.js +0 -1
- package/build/cjs/join-path.js +0 -3
- package/build/cjs/locales/index.js +3 -77
- package/build/cjs/logo-image.js +2 -15
- package/build/cjs/logo.js +1 -8
- package/build/cjs/notification-icon.js +3 -13
- package/build/cjs/notifications.js +1 -12
- package/build/cjs/online-status.js +6 -16
- package/build/cjs/online-status.styles.js +2 -5
- package/build/cjs/profile/use-on-doc-click.js +0 -4
- package/build/cjs/profile/use-on-doc-click.test.js +0 -2
- package/build/cjs/profile-menu/index.js +0 -2
- package/build/cjs/profile-menu/profile-header.js +2 -20
- package/build/cjs/profile-menu/profile-menu.js +10 -33
- package/build/cjs/profile-menu/update-notification.js +3 -17
- package/build/cjs/profile.js +5 -19
- package/build/cjs/title.js +2 -8
- package/build/es/__e2e__/stories/common.js +3 -8
- package/build/es/__e2e__/stories/custom-application-title.js +2 -1
- package/build/es/__e2e__/stories/me-with-avatar.js +2 -1
- package/build/es/__e2e__/stories/online-status-message.js +3 -4
- package/build/es/__e2e__/stories/pwa-enabled.js +2 -1
- package/build/es/__e2e__/stories/user-has-all-authority.js +4 -2
- package/build/es/__e2e__/stories/user-has-no-authorities.js +4 -2
- package/build/es/__e2e__/stories/user-has-web-interpretation-and-messaging-authority.js +4 -2
- package/build/es/__e2e__/stories/user-has-web-interpretation-authority.js +4 -2
- package/build/es/__e2e__/stories/user-has-web-messaging-authority.js +4 -2
- package/build/es/__e2e__/stories/with-debug-info-edge-cases.js +10 -5
- package/build/es/__e2e__/stories/with-special-app-name-character.js +4 -2
- package/build/es/__e2e__/stories/with-update-available-notification.js +4 -2
- package/build/es/__e2e__/stories/zero-unread-interpretations.js +2 -1
- package/build/es/__e2e__/stories/zero-unread-messages.js +2 -1
- package/build/es/apps.js +6 -16
- package/build/es/debug-info/debug-info-menu-item.js +3 -5
- package/build/es/debug-info/debug-info-modal.js +1 -3
- package/build/es/debug-info/debug-info-table.js +1 -3
- package/build/es/features/common/index.js +1 -1
- package/build/es/features/the_headerbar_can_display_online_status/the_headerbar_displays_online_status.js +11 -5
- package/build/es/features/the_headerbar_contains_a_profile_menu/common.js +4 -1
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_a_text_icon_if_the_user_does_not_have_an_avatar.js +2 -2
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_menu_opens.js +4 -1
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_user_can_log_out.js +15 -11
- package/build/es/features/the_search_should_escape_regexp_character/the_user_searches_for_an_app_with_a_regex_character.js +2 -1
- package/build/es/header-bar.js +5 -6
- package/build/es/{header-bar.stories.js → header-bar.prod.stories.js} +32 -11
- package/build/es/join-path.js +0 -1
- package/build/es/logo-image.js +1 -7
- package/build/es/notification-icon.js +2 -4
- package/build/es/notifications.js +0 -2
- package/build/es/online-status.js +6 -6
- package/build/es/online-status.styles.js +1 -1
- package/build/es/profile/use-on-doc-click.js +0 -1
- package/build/es/profile-menu/profile-header.js +1 -9
- package/build/es/profile-menu/profile-menu.js +7 -8
- package/build/es/profile-menu/update-notification.js +2 -4
- package/build/es/profile.js +1 -3
- package/build/es/title.js +1 -1
- package/package.json +18 -18
- /package/build/es/__e2e__/{header-bar.stories.e2e.js → header-bar.e2e.stories.js} +0 -0
|
@@ -90,9 +90,10 @@ export const dataProviderData = {
|
|
|
90
90
|
unreadInterpretations: 10,
|
|
91
91
|
unreadMessageConversations: 5
|
|
92
92
|
}
|
|
93
|
-
};
|
|
94
|
-
// helper from the org unit tree's common.js helper with the same name
|
|
93
|
+
};
|
|
95
94
|
|
|
95
|
+
// Trailing "HeaderBar" because storybook is confusing this with the
|
|
96
|
+
// helper from the org unit tree's common.js helper with the same name
|
|
96
97
|
export const createDecoratorCustomDataProviderHeaderBar = function () {
|
|
97
98
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dataProviderData;
|
|
98
99
|
return fn => {
|
|
@@ -153,17 +154,14 @@ export const providerConfig = {
|
|
|
153
154
|
baseUrl: 'https://domain.tld/',
|
|
154
155
|
apiVersion: ''
|
|
155
156
|
};
|
|
156
|
-
|
|
157
157
|
const MockAlert = _ref => {
|
|
158
158
|
let {
|
|
159
159
|
alert
|
|
160
160
|
} = _ref;
|
|
161
161
|
useEffect(() => {
|
|
162
162
|
var _alert$options;
|
|
163
|
-
|
|
164
163
|
if ((_alert$options = alert.options) !== null && _alert$options !== void 0 && _alert$options.duration) {
|
|
165
164
|
var _alert$options2;
|
|
166
|
-
|
|
167
165
|
setTimeout(() => alert.remove(), (_alert$options2 = alert.options) === null || _alert$options2 === void 0 ? void 0 : _alert$options2.duration);
|
|
168
166
|
}
|
|
169
167
|
}, [alert]);
|
|
@@ -174,7 +172,6 @@ const MockAlert = _ref => {
|
|
|
174
172
|
}
|
|
175
173
|
}, alert.message);
|
|
176
174
|
};
|
|
177
|
-
|
|
178
175
|
MockAlert.propTypes = {
|
|
179
176
|
alert: PropTypes.shape({
|
|
180
177
|
message: PropTypes.string,
|
|
@@ -184,7 +181,6 @@ MockAlert.propTypes = {
|
|
|
184
181
|
remove: PropTypes.func
|
|
185
182
|
})
|
|
186
183
|
};
|
|
187
|
-
|
|
188
184
|
const MockAlertStack = () => {
|
|
189
185
|
const alerts = useAlerts();
|
|
190
186
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -198,7 +194,6 @@ const MockAlertStack = () => {
|
|
|
198
194
|
alert: alert
|
|
199
195
|
})));
|
|
200
196
|
};
|
|
201
|
-
|
|
202
197
|
export const mockOfflineInterface = {
|
|
203
198
|
pwaEnabled: true,
|
|
204
199
|
startRecording: async () => undefined,
|
|
@@ -4,7 +4,8 @@ import { dataProviderData, createDecoratorCustomDataProviderHeaderBar, createDec
|
|
|
4
4
|
export const CustomApplicationTitle = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
CustomApplicationTitle.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
7
|
+
CustomApplicationTitle.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
+
...dataProviderData,
|
|
8
9
|
['systemSettings/applicationTitle']: {
|
|
9
10
|
applicationTitle: 'Barbaz'
|
|
10
11
|
}
|
|
@@ -4,7 +4,8 @@ import { dataProviderData, createDecoratorCustomDataProviderHeaderBar, createDec
|
|
|
4
4
|
export const MeWithAvatar = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
MeWithAvatar.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
7
|
+
MeWithAvatar.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
+
...dataProviderData,
|
|
8
9
|
me: {
|
|
9
10
|
name: 'John Doe',
|
|
10
11
|
email: 'john_doe@dhis2.org',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Button } from '@dhis2-ui/button';
|
|
2
1
|
import { useOnlineStatusMessage } from '@dhis2/app-runtime';
|
|
2
|
+
import { Button } from '@dhis2-ui/button';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { HeaderBar } from '../../index.js';
|
|
5
5
|
import { providerConfig, createDecoratorCustomDataProviderHeaderBar, createDecoratorProvider } from './common.js';
|
|
@@ -15,12 +15,11 @@ export const OnlineStatusMessageUpdate = () => {
|
|
|
15
15
|
}
|
|
16
16
|
}, buttonLabel);
|
|
17
17
|
};
|
|
18
|
-
|
|
19
18
|
const OnlineStatusMessaging = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HeaderBar, {
|
|
20
19
|
appName: "Example!"
|
|
21
20
|
}), /*#__PURE__*/React.createElement(OnlineStatusMessageUpdate, null));
|
|
22
|
-
|
|
23
21
|
export const OnlineStatusMessagingWithPwaEnabled = () => /*#__PURE__*/React.createElement(OnlineStatusMessaging, null);
|
|
24
|
-
OnlineStatusMessagingWithPwaEnabled.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
22
|
+
OnlineStatusMessagingWithPwaEnabled.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
23
|
+
...providerConfig,
|
|
25
24
|
pwaEnabled: true
|
|
26
25
|
})];
|
|
@@ -4,6 +4,7 @@ import { providerConfig, createDecoratorCustomDataProviderHeaderBar, createDecor
|
|
|
4
4
|
export const PWAEnabled = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
PWAEnabled.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
7
|
+
PWAEnabled.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
8
|
+
...providerConfig,
|
|
8
9
|
pwaEnabled: true
|
|
9
10
|
})];
|
|
@@ -4,8 +4,10 @@ import { dataProviderData, createDecoratorCustomDataProviderHeaderBar, createDec
|
|
|
4
4
|
export const UserHasAllAuthority = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
UserHasAllAuthority.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
-
|
|
7
|
+
UserHasAllAuthority.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
+
...dataProviderData,
|
|
9
|
+
me: {
|
|
10
|
+
...dataProviderData.me,
|
|
9
11
|
authorities: ['ALL']
|
|
10
12
|
}
|
|
11
13
|
}), createDecoratorProvider()];
|
|
@@ -4,8 +4,10 @@ import { dataProviderData, createDecoratorCustomDataProviderHeaderBar, createDec
|
|
|
4
4
|
export const UserHasNoAuthorities = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
UserHasNoAuthorities.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
-
|
|
7
|
+
UserHasNoAuthorities.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
+
...dataProviderData,
|
|
9
|
+
me: {
|
|
10
|
+
...dataProviderData.me,
|
|
9
11
|
authorities: []
|
|
10
12
|
}
|
|
11
13
|
}), createDecoratorProvider()];
|
|
@@ -4,8 +4,10 @@ import { dataProviderData, createDecoratorCustomDataProviderHeaderBar, createDec
|
|
|
4
4
|
export const UserHasWebInterpretationAndMessagingAuthority = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
UserHasWebInterpretationAndMessagingAuthority.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
-
|
|
7
|
+
UserHasWebInterpretationAndMessagingAuthority.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
+
...dataProviderData,
|
|
9
|
+
me: {
|
|
10
|
+
...dataProviderData.me,
|
|
9
11
|
authorities: ['M_dhis-web-interpretation', 'M_dhis-web-messaging']
|
|
10
12
|
}
|
|
11
13
|
}), createDecoratorProvider()];
|
|
@@ -4,8 +4,10 @@ import { dataProviderData, createDecoratorCustomDataProviderHeaderBar, createDec
|
|
|
4
4
|
export const UserHasWebInterpretationAuthority = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
UserHasWebInterpretationAuthority.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
-
|
|
7
|
+
UserHasWebInterpretationAuthority.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
+
...dataProviderData,
|
|
9
|
+
me: {
|
|
10
|
+
...dataProviderData.me,
|
|
9
11
|
authorities: ['M_dhis-web-interpretation']
|
|
10
12
|
}
|
|
11
13
|
}), createDecoratorProvider()];
|
|
@@ -4,8 +4,10 @@ import { dataProviderData, createDecoratorCustomDataProviderHeaderBar, createDec
|
|
|
4
4
|
export const UserHasWebMessagingAuthority = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
UserHasWebMessagingAuthority.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
-
|
|
7
|
+
UserHasWebMessagingAuthority.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
+
...dataProviderData,
|
|
9
|
+
me: {
|
|
10
|
+
...dataProviderData.me,
|
|
9
11
|
authorities: ['M_dhis-web-messaging']
|
|
10
12
|
}
|
|
11
13
|
}), createDecoratorProvider()];
|
|
@@ -2,21 +2,26 @@ import React from 'react';
|
|
|
2
2
|
import { HeaderBar } from '../../header-bar.js';
|
|
3
3
|
import { createDecoratorCustomDataProviderHeaderBar, createDecoratorProvider, providerConfig } from './common.js';
|
|
4
4
|
export const WithUnknownInstanceVersion = () => /*#__PURE__*/React.createElement(HeaderBar, null);
|
|
5
|
-
WithUnknownInstanceVersion.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
6
|
-
|
|
5
|
+
WithUnknownInstanceVersion.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
6
|
+
...providerConfig,
|
|
7
|
+
systemInfo: {
|
|
8
|
+
...providerConfig.systemInfo,
|
|
7
9
|
version: undefined
|
|
8
10
|
}
|
|
9
11
|
})];
|
|
10
12
|
export const WithUnknownAppVersion = () => /*#__PURE__*/React.createElement(HeaderBar, null);
|
|
11
|
-
WithUnknownAppVersion.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
13
|
+
WithUnknownAppVersion.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
14
|
+
...providerConfig,
|
|
12
15
|
appVersion: undefined
|
|
13
16
|
})];
|
|
14
17
|
export const WithUnknownAppName = () => /*#__PURE__*/React.createElement(HeaderBar, null);
|
|
15
|
-
WithUnknownAppName.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
18
|
+
WithUnknownAppName.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
19
|
+
...providerConfig,
|
|
16
20
|
appName: undefined
|
|
17
21
|
})];
|
|
18
22
|
export const WithUnknownAppNameAndVersion = () => /*#__PURE__*/React.createElement(HeaderBar, null);
|
|
19
|
-
WithUnknownAppNameAndVersion.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
23
|
+
WithUnknownAppNameAndVersion.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
24
|
+
...providerConfig,
|
|
20
25
|
appName: undefined,
|
|
21
26
|
appVersion: undefined
|
|
22
27
|
})];
|
|
@@ -4,8 +4,10 @@ import { modulesWithSpecialCharacters, dataProviderData, createDecoratorCustomDa
|
|
|
4
4
|
export const WithSpecialAppNameCharacters = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
WithSpecialAppNameCharacters.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
-
|
|
7
|
+
WithSpecialAppNameCharacters.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
+
...dataProviderData,
|
|
9
|
+
['action::menu/getModules']: {
|
|
10
|
+
...dataProviderData['action::menu/getModules'],
|
|
9
11
|
modules: modulesWithSpecialCharacters
|
|
10
12
|
}
|
|
11
13
|
}), createDecoratorProvider()];
|
|
@@ -8,12 +8,14 @@ export const WithUpdateAvailableNotification = () => {
|
|
|
8
8
|
onApplyAvailableUpdate: () => setModalOpen(true)
|
|
9
9
|
}), modalOpen && /*#__PURE__*/React.createElement("div", null, "The callback was successful"));
|
|
10
10
|
};
|
|
11
|
-
WithUpdateAvailableNotification.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
11
|
+
WithUpdateAvailableNotification.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
12
|
+
...providerConfig,
|
|
12
13
|
appName: 'Data Visualizer'
|
|
13
14
|
})];
|
|
14
15
|
export const WithUpdateAvailableNotificationNoAppName = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
15
16
|
updateAvailable: true
|
|
16
17
|
});
|
|
17
|
-
WithUpdateAvailableNotificationNoAppName.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
18
|
+
WithUpdateAvailableNotificationNoAppName.decorators = [createDecoratorCustomDataProviderHeaderBar(), createDecoratorProvider({
|
|
19
|
+
...providerConfig,
|
|
18
20
|
appName: undefined
|
|
19
21
|
})];
|
|
@@ -4,7 +4,8 @@ import { dataProviderData, createDecoratorCustomDataProviderHeaderBar, createDec
|
|
|
4
4
|
export const ZeroUnreadInterpretations = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
ZeroUnreadInterpretations.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
7
|
+
ZeroUnreadInterpretations.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
+
...dataProviderData,
|
|
8
9
|
['me/dashboard']: {
|
|
9
10
|
unreadInterpretations: 0
|
|
10
11
|
}
|
|
@@ -4,7 +4,8 @@ import { dataProviderData, createDecoratorCustomDataProviderHeaderBar, createDec
|
|
|
4
4
|
export const ZeroUnreadMessages = () => /*#__PURE__*/React.createElement(HeaderBar, {
|
|
5
5
|
appName: "Example!"
|
|
6
6
|
});
|
|
7
|
-
ZeroUnreadMessages.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
7
|
+
ZeroUnreadMessages.decorators = [createDecoratorCustomDataProviderHeaderBar({
|
|
8
|
+
...dataProviderData,
|
|
8
9
|
['me/dashboard']: {
|
|
9
10
|
unreadMessages: 0
|
|
10
11
|
}
|
package/build/es/apps.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { Card } from '@dhis2-ui/card';
|
|
3
|
-
import { InputField } from '@dhis2-ui/input';
|
|
4
2
|
import { useConfig } from '@dhis2/app-runtime';
|
|
5
3
|
import { colors, spacers, theme } from '@dhis2/ui-constants';
|
|
6
4
|
import { IconApps24, IconSettings24 } from '@dhis2/ui-icons';
|
|
5
|
+
import { Card } from '@dhis2-ui/card';
|
|
6
|
+
import { InputField } from '@dhis2-ui/input';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
9
9
|
import { joinPath } from './join-path.js';
|
|
10
10
|
import i18n from './locales/index.js';
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* Copied from here:
|
|
13
14
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
16
|
function escapeRegExpCharacters(text) {
|
|
17
17
|
return text.replace(/[/.*+?^${}()|[\]\\]/g, '\\$&');
|
|
18
18
|
}
|
|
19
|
-
|
|
20
19
|
function Search(_ref) {
|
|
21
20
|
let {
|
|
22
21
|
value,
|
|
@@ -46,12 +45,10 @@ function Search(_ref) {
|
|
|
46
45
|
id: "4264724627"
|
|
47
46
|
}, ["div.jsx-4264724627{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;height:52px;margin:8px;}", "span.jsx-4264724627{-webkit-flex:1 100%;-ms-flex:1 100%;flex:1 100%;}", "span.jsx-4264724627:last-child{-webkit-flex:1 auto;-ms-flex:1 auto;flex:1 auto;margin:8px;}"]));
|
|
48
47
|
}
|
|
49
|
-
|
|
50
48
|
Search.propTypes = {
|
|
51
49
|
value: PropTypes.string.isRequired,
|
|
52
50
|
onChange: PropTypes.func.isRequired
|
|
53
51
|
};
|
|
54
|
-
|
|
55
52
|
function Item(_ref2) {
|
|
56
53
|
let {
|
|
57
54
|
name,
|
|
@@ -70,15 +67,13 @@ function Item(_ref2) {
|
|
|
70
67
|
}, name), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
71
68
|
id: "1412616027",
|
|
72
69
|
dynamic: [theme.primary050]
|
|
73
|
-
}, ["a.__jsx-style-dynamic-selector{display:inline-block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:96px;margin:8px;border-radius:12px;-webkit-text-decoration:none;text-decoration:none;cursor:pointer;}",
|
|
70
|
+
}, ["a.__jsx-style-dynamic-selector{display:inline-block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:96px;margin:8px;border-radius:12px;-webkit-text-decoration:none;text-decoration:none;cursor:pointer;}", `a.__jsx-style-dynamic-selector:hover,a.__jsx-style-dynamic-selector:focus{background-color:${theme.primary050};cursor:pointer;}`, "a.__jsx-style-dynamic-selector:hover>div.__jsx-style-dynamic-selector{font-weight:500;cursor:pointer;}", "img.__jsx-style-dynamic-selector{width:48px;height:48px;margin:8px;cursor:pointer;}", "div.__jsx-style-dynamic-selector{overflow-wrap:anywhere;margin-top:14px;color:rgba(0,0,0,0.87);font-size:12px;-webkit-letter-spacing:0.01em;-moz-letter-spacing:0.01em;-ms-letter-spacing:0.01em;letter-spacing:0.01em;line-height:14px;text-align:center;cursor:pointer;}"]));
|
|
74
71
|
}
|
|
75
|
-
|
|
76
72
|
Item.propTypes = {
|
|
77
73
|
img: PropTypes.string,
|
|
78
74
|
name: PropTypes.string,
|
|
79
75
|
path: PropTypes.string
|
|
80
76
|
};
|
|
81
|
-
|
|
82
77
|
function List(_ref3) {
|
|
83
78
|
let {
|
|
84
79
|
apps,
|
|
@@ -104,7 +99,7 @@ function List(_ref3) {
|
|
|
104
99
|
icon
|
|
105
100
|
} = _ref5;
|
|
106
101
|
return /*#__PURE__*/React.createElement(Item, {
|
|
107
|
-
key:
|
|
102
|
+
key: `app-${name}-${idx}`,
|
|
108
103
|
name: displayName || name,
|
|
109
104
|
path: defaultAction,
|
|
110
105
|
img: icon
|
|
@@ -113,12 +108,10 @@ function List(_ref3) {
|
|
|
113
108
|
id: "2424821176"
|
|
114
109
|
}, ["div.jsx-2424821176{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-align-content:flex-start;-ms-flex-line-pack:start;align-content:flex-start;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;width:30vw;min-width:300px;max-width:560px;min-height:200px;max-height:465px;margin-block-start:0;margin-block-end:8px;margin-inline:8px;overflow:auto;overflow-x:hidden;}"]));
|
|
115
110
|
}
|
|
116
|
-
|
|
117
111
|
List.propTypes = {
|
|
118
112
|
apps: PropTypes.array,
|
|
119
113
|
filter: PropTypes.string
|
|
120
114
|
};
|
|
121
|
-
|
|
122
115
|
const AppMenu = _ref6 => {
|
|
123
116
|
let {
|
|
124
117
|
apps,
|
|
@@ -138,13 +131,11 @@ const AppMenu = _ref6 => {
|
|
|
138
131
|
id: "3826299842"
|
|
139
132
|
}, ["div.jsx-3826299842{z-index:10000;position:absolute;inset-inline-end:-4px;}"]));
|
|
140
133
|
};
|
|
141
|
-
|
|
142
134
|
AppMenu.propTypes = {
|
|
143
135
|
apps: PropTypes.array.isRequired,
|
|
144
136
|
onFilterChange: PropTypes.func.isRequired,
|
|
145
137
|
filter: PropTypes.string
|
|
146
138
|
};
|
|
147
|
-
|
|
148
139
|
const Apps = _ref7 => {
|
|
149
140
|
let {
|
|
150
141
|
apps
|
|
@@ -185,9 +176,8 @@ const Apps = _ref7 => {
|
|
|
185
176
|
}) : null, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
186
177
|
id: "325245423",
|
|
187
178
|
dynamic: [spacers.dp4, spacers.dp12]
|
|
188
|
-
}, [
|
|
179
|
+
}, [`button.__jsx-style-dynamic-selector{display:block;background:transparent;padding-block-start:${spacers.dp4};padding-block-end:0;padding-inline:${spacers.dp12};border:0;cursor:pointer;height:100%;}`, "button.__jsx-style-dynamic-selector:focus{outline:2px solid white;outline-offset:-2px;}", "button.__jsx-style-dynamic-selector:focus.__jsx-style-dynamic-selector:not(:focus-visible){outline:none;}", "button.__jsx-style-dynamic-selector:hover{background:#1a557f;}", "button.__jsx-style-dynamic-selector:active{background:#104067;}", "div.__jsx-style-dynamic-selector{position:relative;height:100%;}"]));
|
|
189
180
|
};
|
|
190
|
-
|
|
191
181
|
Apps.propTypes = {
|
|
192
182
|
apps: PropTypes.array.isRequired
|
|
193
183
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { MenuItem } from '@dhis2-ui/menu';
|
|
3
2
|
import { colors } from '@dhis2/ui-constants';
|
|
3
|
+
import { MenuItem } from '@dhis2-ui/menu';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import i18n from '../locales/index.js';
|
|
@@ -11,12 +11,10 @@ export const DebugInfoMenuItem = _ref => {
|
|
|
11
11
|
showDebugInfoModal
|
|
12
12
|
} = _ref;
|
|
13
13
|
const debugInfo = useDebugInfo();
|
|
14
|
-
|
|
15
14
|
const openDebugModal = () => {
|
|
16
15
|
hideProfileMenu();
|
|
17
16
|
showDebugInfoModal();
|
|
18
17
|
};
|
|
19
|
-
|
|
20
18
|
const debugInfoLabel = /*#__PURE__*/React.createElement("div", {
|
|
21
19
|
className: _JSXStyle.dynamic([["3534786758", [colors.grey700]]]) + " " + "root"
|
|
22
20
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -27,14 +25,14 @@ export const DebugInfoMenuItem = _ref => {
|
|
|
27
25
|
}) : i18n.t('DHIS2 version unknown')), /*#__PURE__*/React.createElement("div", {
|
|
28
26
|
"data-test": "dhis2-ui-headerbar-appinfo",
|
|
29
27
|
className: _JSXStyle.dynamic([["3534786758", [colors.grey700]]]) + " " + "version"
|
|
30
|
-
}, debugInfo.app_name ? debugInfo.app_version ?
|
|
28
|
+
}, debugInfo.app_name ? debugInfo.app_version ? `${debugInfo.app_name} ${debugInfo.app_version}` : i18n.t('{{appName}} version unknown', {
|
|
31
29
|
appName: debugInfo.app_name
|
|
32
30
|
}) : debugInfo.app_version ? i18n.t('App {{appVersion}}', {
|
|
33
31
|
appVersion: debugInfo.app_version
|
|
34
32
|
}) : i18n.t('App version unknown')), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
35
33
|
id: "3534786758",
|
|
36
34
|
dynamic: [colors.grey700]
|
|
37
|
-
}, [
|
|
35
|
+
}, [`.root.__jsx-style-dynamic-selector{color:${colors.grey700};font-style:italic;font-size:14px;line-height:17px;}`, ".instance-info.__jsx-style-dynamic-selector{margin-bottom:4px;}", ".version.__jsx-style-dynamic-selector{white-space:no-wrap;}"]));
|
|
38
36
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
39
37
|
dense: true,
|
|
40
38
|
onClick: openDebugModal,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { useAlert } from '@dhis2/app-runtime';
|
|
1
2
|
import { Button, ButtonStrip } from '@dhis2-ui/button';
|
|
2
3
|
import { Modal, ModalActions, ModalContent, ModalTitle } from '@dhis2-ui/modal';
|
|
3
|
-
import { useAlert } from '@dhis2/app-runtime';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import i18n from '../locales/index.js';
|
|
@@ -16,13 +16,11 @@ export function DebugInfoModal(_ref) {
|
|
|
16
16
|
} = useAlert('Debug information copied to clipboard', {
|
|
17
17
|
duration: 3000
|
|
18
18
|
});
|
|
19
|
-
|
|
20
19
|
const copyDebugInfo = () => {
|
|
21
20
|
navigator.clipboard.writeText(debugInfo);
|
|
22
21
|
onClose();
|
|
23
22
|
showClipboardAlert();
|
|
24
23
|
};
|
|
25
|
-
|
|
26
24
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
27
25
|
position: "middle",
|
|
28
26
|
dataTest: "dhis2-ui-headerbar-debuginfomodal"
|
|
@@ -2,7 +2,6 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import { colors } from '@dhis2/ui-constants';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useDebugInfo } from './use-debug-info.js';
|
|
5
|
-
|
|
6
5
|
const formatDebugInfoKey = key => {
|
|
7
6
|
const tokens = key.split('_');
|
|
8
7
|
return tokens.map(token => {
|
|
@@ -13,7 +12,6 @@ const formatDebugInfoKey = key => {
|
|
|
13
12
|
}
|
|
14
13
|
}).join(' ');
|
|
15
14
|
};
|
|
16
|
-
|
|
17
15
|
export function DebugInfoTable() {
|
|
18
16
|
const debugInfo = useDebugInfo();
|
|
19
17
|
return /*#__PURE__*/React.createElement("table", {
|
|
@@ -31,5 +29,5 @@ export function DebugInfoTable() {
|
|
|
31
29
|
}, debugInfo[key])))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
32
30
|
id: "4076206425",
|
|
33
31
|
dynamic: [colors.grey700]
|
|
34
|
-
}, [
|
|
32
|
+
}, [`table.__jsx-style-dynamic-selector{white-space:pre-wrap;font-size:14px;line-height:1.2;color:${colors.grey700};font-famile:Menlo,Courier,monospace !important;}`, "td.__jsx-style-dynamic-selector{padding-block:3px;padding-inline-end:16px;padding-inline-start:0;}", ".debug-info-key.__jsx-style-dynamic-selector{font-weight:bold;}"]));
|
|
35
33
|
}
|
|
@@ -2,7 +2,7 @@ import { Before, Given } from '@badeball/cypress-cucumber-preprocessor';
|
|
|
2
2
|
export const baseUrl = 'https://domain.tld/';
|
|
3
3
|
export const webCommons = 'https://domain.tld/dhis-web-commons/';
|
|
4
4
|
Before(() => {
|
|
5
|
-
cy.intercept('GET',
|
|
5
|
+
cy.intercept('GET', `${baseUrl}api/fileResources/avatarId/data`, {
|
|
6
6
|
fixture: 'HeaderBar/avatar.png'
|
|
7
7
|
}).as('avatar');
|
|
8
8
|
});
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { Before, After, Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
|
|
1
|
+
import { Before, After, Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
|
|
3
|
+
// see https://github.com/cypress-io/cypress/issues/17723#issuecomment-1457064322
|
|
3
4
|
const goOffline = () => {
|
|
4
|
-
cy.log('**go offline**')
|
|
5
|
+
cy.log('**go offline**')
|
|
6
|
+
// stub every request with a StaticResponse to simulate network error
|
|
5
7
|
.then(() => cy.intercept('*', {
|
|
6
8
|
forceNetworkError: true
|
|
7
9
|
})).then(() => cy.window().then(win => win.dispatchEvent(new Event('offline'))));
|
|
8
10
|
};
|
|
9
|
-
|
|
10
11
|
const goOnline = () => {
|
|
11
12
|
// disable offline mode, otherwise we will break our tests :)
|
|
12
|
-
cy.log('**go online**')
|
|
13
|
+
cy.log('**go online**')
|
|
14
|
+
// go back to normal network behavior
|
|
13
15
|
.then(() => cy.intercept('*')).then(() => cy.window().then(win => win.dispatchEvent(new Event('online'))));
|
|
14
16
|
};
|
|
15
|
-
|
|
16
17
|
Before(() => {
|
|
17
18
|
goOnline();
|
|
18
19
|
});
|
|
@@ -22,6 +23,7 @@ Given('the HeaderBar loads without error with showOnlineStatus configured', () =
|
|
|
22
23
|
});
|
|
23
24
|
Given('the HeaderBar loads without error when PWA is enabled', () => {
|
|
24
25
|
cy.visitStory('HeaderBarTesting', 'PWA Enabled');
|
|
26
|
+
cy.get(':contains("Online")').should('exist');
|
|
25
27
|
});
|
|
26
28
|
Given('the HeaderBar loads and is PWA enabled so online status messages will be visible', () => {
|
|
27
29
|
cy.visitStory('HeaderBarTesting', 'Online Status Messaging With PWA Enabled');
|
|
@@ -56,6 +58,10 @@ Given('the browser goes offline', () => {
|
|
|
56
58
|
goOffline();
|
|
57
59
|
});
|
|
58
60
|
Then('the status badge shows offline', () => {
|
|
61
|
+
// cy.get('[data-test="headerbar-online-status"].badge .label')
|
|
62
|
+
// .invoke('text')
|
|
63
|
+
// .should('equal', 'Offline')
|
|
64
|
+
|
|
59
65
|
cy.get('[data-test="headerbar-online-status"].badge .label').should($label => {
|
|
60
66
|
expect($label.text()).to.equal('Offline');
|
|
61
67
|
});
|
|
@@ -3,5 +3,8 @@ Then('the HeaderBar does not display the profile menu', () => {
|
|
|
3
3
|
cy.get('[data-test="headerbar-profile-menu"]').should('not.exist');
|
|
4
4
|
});
|
|
5
5
|
When('the user opens the menu', () => {
|
|
6
|
-
cy.get(
|
|
6
|
+
cy.get(`
|
|
7
|
+
[data-test="headerbar-profile-icon-text"],
|
|
8
|
+
[data-test="headerbar-profile-icon-image"]
|
|
9
|
+
`).click();
|
|
7
10
|
});
|
|
@@ -2,7 +2,7 @@ import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
|
|
|
2
2
|
Given('the HeaderBar loads without an error and the user does not have an avatar', () => {
|
|
3
3
|
cy.visitStory('HeaderBarTesting', 'Default');
|
|
4
4
|
});
|
|
5
|
-
Then(
|
|
5
|
+
Then(`the headerbar contains a text icon of size 36px`, () => {
|
|
6
6
|
cy.fixture('HeaderBar/me').then(() => {
|
|
7
7
|
cy.get('[data-test="headerbar-profile-icon-text"]').should('be.visible').and('have.css', 'height', '36px').and('have.css', 'width', '36px');
|
|
8
8
|
});
|
|
@@ -10,7 +10,7 @@ Then("the headerbar contains a text icon of size 36px", () => {
|
|
|
10
10
|
When('the user clicks on the text icon', () => {
|
|
11
11
|
cy.get('[data-test="headerbar-profile-icon-text"]').click();
|
|
12
12
|
});
|
|
13
|
-
Then(
|
|
13
|
+
Then(`the profile menu contains a text icon of size 48px`, () => {
|
|
14
14
|
cy.fixture('HeaderBar/me').then(() => {
|
|
15
15
|
cy.get('[data-test="headerbar-profile-menu-icon-text"]').should('be.visible').and('have.css', 'height', '48px').and('have.css', 'width', '48px');
|
|
16
16
|
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
When('the user clicks on the profile icons', () => {
|
|
3
|
-
cy.get(
|
|
3
|
+
cy.get(`
|
|
4
|
+
[data-test="headerbar-profile-icon-text"],
|
|
5
|
+
[data-test="headerbar-profile-icon-image"]
|
|
6
|
+
`).click();
|
|
4
7
|
});
|
|
5
8
|
Then('the menu opens', () => {
|
|
6
9
|
cy.get('[data-test="headerbar-profile-menu"]').should('be.visible');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
import { baseUrl } from '../common/index.js';
|
|
3
|
-
const logoutUrl =
|
|
3
|
+
const logoutUrl = `${baseUrl}dhis-web-commons-security/logout.action`;
|
|
4
4
|
Then('contains a link to log out the user', () => {
|
|
5
5
|
cy.get('[data-test="headerbar-profile-menu"] > li').should(lis => {
|
|
6
6
|
const menuItem = lis.eq(4);
|
|
@@ -16,23 +16,27 @@ Then('the user clicks the link to log out', () => {
|
|
|
16
16
|
});
|
|
17
17
|
Then('a loading mask covers the screen', () => {
|
|
18
18
|
cy.get('[data-test="headerbar-profile-menu-loading-mask"]').should('be.visible');
|
|
19
|
-
});
|
|
19
|
+
});
|
|
20
20
|
|
|
21
|
+
// Currently not working
|
|
21
22
|
When('clearSensitiveCaches is called', async () => {
|
|
22
23
|
// Open caches to test 'clearSensitiveCaches':
|
|
23
24
|
// A keepable cache
|
|
24
|
-
await caches.open('workbox-precache-v2-asdf');
|
|
25
|
-
|
|
26
|
-
await caches.open('test-cache');
|
|
27
|
-
|
|
28
|
-
const keys = await caches.keys(); // Static asset caches are kept
|
|
29
|
-
|
|
30
|
-
expect(keys).to.include('workbox-precache-v2-asdf'); // Others are removed
|
|
25
|
+
await caches.open('workbox-precache-v2-asdf');
|
|
26
|
+
// Other, potentially-sensitive cache
|
|
27
|
+
await caches.open('test-cache');
|
|
31
28
|
|
|
29
|
+
// Todo: wait for function to resolve (loading mask goes away?)
|
|
30
|
+
const keys = await caches.keys();
|
|
31
|
+
// Static asset caches are kept
|
|
32
|
+
expect(keys).to.include('workbox-precache-v2-asdf');
|
|
33
|
+
// Others are removed
|
|
32
34
|
expect(keys).not.to.include('test-cache');
|
|
33
|
-
});
|
|
35
|
+
});
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
// Currently not working
|
|
38
|
+
Then('the window navigates to the logout URL', () => {
|
|
39
|
+
// (Currently unable to stub window.location.assign;
|
|
36
40
|
// would be done in 'Then the user clicks link to log out')
|
|
37
41
|
// cy.get('@locationAssign').should('be.calledWith', logoutUrl)
|
|
38
42
|
});
|
|
@@ -3,8 +3,9 @@ import { modulesWithSpecialCharacters } from '../../__e2e__/stories/modulesWithS
|
|
|
3
3
|
Given(/some app names contain a (.*)/, character => {
|
|
4
4
|
// Needs to be wrapped, otherwise for some reason the wrong char is in the scope
|
|
5
5
|
cy.wrap(character).then(char => {
|
|
6
|
-
cy.visitStory('HeaderBarTesting', 'With Special App Name Characters');
|
|
6
|
+
cy.visitStory('HeaderBarTesting', 'With Special App Name Characters');
|
|
7
7
|
|
|
8
|
+
// verify that there's a module with the special char in its name
|
|
8
9
|
const modulesWithSpecialChar = modulesWithSpecialCharacters.filter(module => {
|
|
9
10
|
return module.displayName.indexOf(char) !== -1;
|
|
10
11
|
});
|