@atlassian/atlassian-connect-js 5.3.190
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/.depcheckrc.json +16 -0
- package/.editorconfig +9 -0
- package/.envrc +5 -0
- package/.eslintignore +12 -0
- package/.eslintrc +31 -0
- package/.husky/pre-commit +11 -0
- package/.lintstagedrc.js +6 -0
- package/.netrc +1 -0
- package/.npmrc-public +4 -0
- package/.nvmrc +1 -0
- package/LICENSE +3 -0
- package/README.md +281 -0
- package/bitbucket-pipelines.yml +33 -0
- package/build/bin/bin-helper.js +29 -0
- package/build/bin/npm-postinstall.js +9 -0
- package/build/configs/append-sourcemapping.js +13 -0
- package/build/configs/availabletasks.js +15 -0
- package/build/configs/clean.js +12 -0
- package/build/configs/concat.js +44 -0
- package/build/configs/copy.js +32 -0
- package/build/configs/index.js +19 -0
- package/build/configs/jshint.js +9 -0
- package/build/configs/karma.js +11 -0
- package/build/configs/replace.js +10 -0
- package/build/configs/requirejs.js +187 -0
- package/build/configs/saucelabs-launchers.js +30 -0
- package/build/configs/shell.js +24 -0
- package/build/configs/uglify.js +15 -0
- package/build/configs/watch.js +45 -0
- package/build/end.frag +13 -0
- package/build/start.frag +18 -0
- package/bundlesize.config.json +14 -0
- package/dist/connect-host.css +225 -0
- package/dist/connect-host.js +13908 -0
- package/dist/connect-host.min.css +1 -0
- package/dist/iframe-fedramp.js +13663 -0
- package/dist/iframe.js +13663 -0
- package/dist/legacy-text-colors.css +245 -0
- package/dist/surfaces.css +11 -0
- package/dist/themes/atlaskit-tokens_dark-future.css +6 -0
- package/dist/themes/atlaskit-tokens_dark.css +394 -0
- package/dist/themes/atlaskit-tokens_legacy-dark.css +394 -0
- package/dist/themes/atlaskit-tokens_legacy-light.css +394 -0
- package/dist/themes/atlaskit-tokens_light-future.css +6 -0
- package/dist/themes/atlaskit-tokens_light.css +394 -0
- package/dist/themes/atlaskit-tokens_shape.css +14 -0
- package/dist/themes/atlaskit-tokens_spacing.css +26 -0
- package/dist/themes/atlaskit-tokens_typography-adg3.css +25 -0
- package/dist/themes/atlaskit-tokens_typography-modernized.css +25 -0
- package/dist/themes/atlaskit-tokens_typography-refreshed.css +25 -0
- package/gulpfile.js +204 -0
- package/memleak-check/app.html +10 -0
- package/memleak-check/index.html +31 -0
- package/memleak-check/index.js +33 -0
- package/package.json +102 -0
- package/renovate.json +11 -0
- package/security-assistant.yml +2 -0
- package/spec/.eslintrc +10 -0
- package/spec/config/karma.base.conf.js +200 -0
- package/spec/config/karma.conf.js +20 -0
- package/spec/fixtures/base_dialog_component_tests.js +180 -0
- package/spec/mocks/mock_feature_flag.js +23 -0
- package/spec/tests/amd_spec.js +122 -0
- package/spec/tests/analytics_dispatcher_spec.js +429 -0
- package/spec/tests/analytics_performance_spec.js +41 -0
- package/spec/tests/button_spec.js +143 -0
- package/spec/tests/dialog_extension_spec.js +59 -0
- package/spec/tests/dialog_module_provider_spec.js +499 -0
- package/spec/tests/dialog_module_spec.js +395 -0
- package/spec/tests/dialog_spec.js +296 -0
- package/spec/tests/dialog_webitem_spec.js +183 -0
- package/spec/tests/dropdown_module_spec.js +77 -0
- package/spec/tests/env_module_spec.js +153 -0
- package/spec/tests/events_spec.js +77 -0
- package/spec/tests/extension_configuration_options_store_spec.js +25 -0
- package/spec/tests/flag_module_provider_spec.js +79 -0
- package/spec/tests/flag_module_spec.js +118 -0
- package/spec/tests/flag_spec.js +243 -0
- package/spec/tests/host-api_spec.js +220 -0
- package/spec/tests/iframe-create_spec.js +43 -0
- package/spec/tests/iframe_container_spec.js +19 -0
- package/spec/tests/iframe_spec.js +265 -0
- package/spec/tests/inline_dialog_spec.js +41 -0
- package/spec/tests/inline_dialog_webitem_spec.js +331 -0
- package/spec/tests/loading_indicator_spec.js +48 -0
- package/spec/tests/messages_module_spec.js +108 -0
- package/spec/tests/meta_spec.js +71 -0
- package/spec/tests/module_args_spec.js +52 -0
- package/spec/tests/observe_spec.js +73 -0
- package/spec/tests/public_events.spec.js +102 -0
- package/spec/tests/scroll_position_spec.js +109 -0
- package/spec/tests/theming_spec.js +594 -0
- package/spec/tests/util_spec.js +55 -0
- package/spec/tests/utils/base64_spec.js +20 -0
- package/spec/tests/utils/button_spec.js +11 -0
- package/spec/tests/utils/cookie_spec.js +19 -0
- package/spec/tests/utils/deprecate_spec.js +22 -0
- package/spec/tests/utils/dialog_spec.js +297 -0
- package/spec/tests/utils/host_util_spec.js +45 -0
- package/spec/tests/utils/iframe_spec.js +41 -0
- package/spec/tests/utils/jwt_spec.js +135 -0
- package/spec/tests/utils/url_spec.js +37 -0
- package/spec/tests/utils/waitUntilReadyNextTick.js +5 -0
- package/spec/tests/utils/webitem.js +219 -0
- package/spec/tests/webitem_spec.js +131 -0
- package/src/css/host/dialog.css +144 -0
- package/src/css/host/flags.css +5 -0
- package/src/css/host/host.css +64 -0
- package/src/css/host/messages.css +12 -0
- package/src/css/plugin/legacy-text-colors.less +55 -0
- package/src/css/plugin/surfaces.css +11 -0
- package/src/host/ACJSFrameworkAdaptor.js +44 -0
- package/src/host/actions/analytics_action.js +35 -0
- package/src/host/actions/button_actions.js +21 -0
- package/src/host/actions/dialog_actions.js +27 -0
- package/src/host/actions/dialog_extension_actions.js +25 -0
- package/src/host/actions/dom_event_actions.js +32 -0
- package/src/host/actions/dropdown_actions.js +12 -0
- package/src/host/actions/env_actions.js +57 -0
- package/src/host/actions/event_actions.js +33 -0
- package/src/host/actions/flag_actions.js +22 -0
- package/src/host/actions/iframe_actions.js +27 -0
- package/src/host/actions/inline_dialog_actions.js +26 -0
- package/src/host/actions/inline_dialog_webitem_actions.js +10 -0
- package/src/host/actions/jwt_actions.js +51 -0
- package/src/host/actions/loading_indicator_actions.js +10 -0
- package/src/host/actions/module_actions.js +14 -0
- package/src/host/actions/webitem_actions.js +29 -0
- package/src/host/components/button.js +112 -0
- package/src/host/components/dialog.js +447 -0
- package/src/host/components/dialog_extension.js +106 -0
- package/src/host/components/dialog_webitem.js +69 -0
- package/src/host/components/flag.js +102 -0
- package/src/host/components/iframe.js +130 -0
- package/src/host/components/iframe_container.js +38 -0
- package/src/host/components/inline_dialog.js +108 -0
- package/src/host/components/inline_dialog_webitem.js +157 -0
- package/src/host/components/loading_indicator.js +110 -0
- package/src/host/components/webitem.js +227 -0
- package/src/host/deprecate.js +20 -0
- package/src/host/dispatchers/analytics_dispatcher.js +512 -0
- package/src/host/dispatchers/event_dispatcher.js +46 -0
- package/src/host/dollar.js +8 -0
- package/src/host/host-api.js +325 -0
- package/src/host/iframe-create.js +7 -0
- package/src/host/index.js +108 -0
- package/src/host/module-providers.js +13 -0
- package/src/host/modules/_featureFlag.js +42 -0
- package/src/host/modules/_performance.js +54 -0
- package/src/host/modules/analytics.js +17 -0
- package/src/host/modules/dialog.js +496 -0
- package/src/host/modules/dropdown.js +255 -0
- package/src/host/modules/env.js +156 -0
- package/src/host/modules/events.js +28 -0
- package/src/host/modules/flag.js +170 -0
- package/src/host/modules/host.js +19 -0
- package/src/host/modules/inline-dialog.js +33 -0
- package/src/host/modules/messages.js +309 -0
- package/src/host/modules/page.js +29 -0
- package/src/host/modules/scroll-position.js +102 -0
- package/src/host/modules/theming.js +114 -0
- package/src/host/stores/extension_configuration_options_store.js +24 -0
- package/src/host/util.js +98 -0
- package/src/host/utils/access-narrowing-context.js +18 -0
- package/src/host/utils/base64.js +22 -0
- package/src/host/utils/button.js +10 -0
- package/src/host/utils/cookie.js +14 -0
- package/src/host/utils/dialog.js +239 -0
- package/src/host/utils/feature-flag.js +27 -0
- package/src/host/utils/iframe.js +23 -0
- package/src/host/utils/jwt.js +60 -0
- package/src/host/utils/observe.js +34 -0
- package/src/host/utils/removal-observer.js +30 -0
- package/src/host/utils/simplexdm.js +58 -0
- package/src/host/utils/url.js +23 -0
- package/src/host/utils/webitem.js +214 -0
- package/src/plugin/amd.js +115 -0
- package/src/plugin/analytics.js +84 -0
- package/src/plugin/deprecate.js +16 -0
- package/src/plugin/dialog.js +197 -0
- package/src/plugin/dollar.js +77 -0
- package/src/plugin/events-instance.js +2 -0
- package/src/plugin/events.js +246 -0
- package/src/plugin/extension_configuration_options_store.js +27 -0
- package/src/plugin/featureFlag.js +8 -0
- package/src/plugin/index.js +118 -0
- package/src/plugin/meta.js +14 -0
- package/src/plugin/public-events.js +73 -0
- package/src/plugin/theming.js +211 -0
- package/src/plugin/util.js +104 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import WebItemUtils from 'src/host/utils/webitem';
|
|
2
|
+
|
|
3
|
+
describe('webitem utils', () => {
|
|
4
|
+
describe('sanitizeTriggers', () => {
|
|
5
|
+
it('sanitizes array', () => {
|
|
6
|
+
const triggers = ['mouseenter', 'click'];
|
|
7
|
+
const expected = 'mouseenter click';
|
|
8
|
+
expect(WebItemUtils.sanitizeTriggers(triggers)).toBe(expected);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('sanitizes string', () => {
|
|
12
|
+
const triggers = ' mouseenter click ';
|
|
13
|
+
const expected = 'mouseenter click';
|
|
14
|
+
expect(WebItemUtils.sanitizeTriggers(triggers)).toBe(expected);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('uniqueId', () => {
|
|
19
|
+
it('returns a unique webitem id', () => {
|
|
20
|
+
const id1 = WebItemUtils.uniqueId();
|
|
21
|
+
const id2 = WebItemUtils.uniqueId();
|
|
22
|
+
expect(id1).not.toEqual(id2);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('getExtensionKey', () => {
|
|
27
|
+
it('returns false if key is missing from class name', () => {
|
|
28
|
+
expect(WebItemUtils.getExtensionKey('')).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('returns extension key', () => {
|
|
32
|
+
const expectedKey = 'somekey1234';
|
|
33
|
+
const cssClass = `ap-plugin-key-${expectedKey}`
|
|
34
|
+
expect(WebItemUtils.getExtensionKey(cssClass)).toBe(expectedKey);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe('getKey', () => {
|
|
39
|
+
it('returns false if key is missing from class name', () => {
|
|
40
|
+
const cssClass = ''
|
|
41
|
+
expect(WebItemUtils.getKey(cssClass)).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('returns module key', () => {
|
|
45
|
+
const expectedKey = 'somekey1234';
|
|
46
|
+
const cssClass = `ap-module-key-${expectedKey}`
|
|
47
|
+
expect(WebItemUtils.getKey(cssClass)).toBe(expectedKey);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('getOptionsForWebItem', () => {
|
|
52
|
+
const dialogOptions = {
|
|
53
|
+
options: {
|
|
54
|
+
someKey: 'someVal'
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const inlineDialogOptions = {
|
|
59
|
+
options: {
|
|
60
|
+
someKey: 'otherSomeVal'
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const dialogOptionsWithProductContext = {
|
|
65
|
+
options: {
|
|
66
|
+
productContext: {
|
|
67
|
+
key1: 'val1',
|
|
68
|
+
key2: 'val2'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
beforeEach(() => {
|
|
74
|
+
window._AP = {
|
|
75
|
+
_convertConnectOptions: function(data){
|
|
76
|
+
return {
|
|
77
|
+
options: {
|
|
78
|
+
productContext: JSON.parse(data.productCtx),
|
|
79
|
+
structuredContext: JSON.parse(data.structuredContext)
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
dialogModules: {
|
|
84
|
+
addonKey: {
|
|
85
|
+
moduleKey: dialogOptions,
|
|
86
|
+
moduleWithCtxKey: dialogOptionsWithProductContext
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
inlineDialogModules: {
|
|
90
|
+
addonKey: {
|
|
91
|
+
moduleKey: inlineDialogOptions
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
afterEach(() => {
|
|
98
|
+
delete window._AP._convertConnectOptions;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('returns options of existing dialog webitem', () => {
|
|
102
|
+
const extensionKey = 'addonKey';
|
|
103
|
+
const key = 'moduleKey';
|
|
104
|
+
const $target = $('<div></div>');
|
|
105
|
+
const cssClass = `ap-module-key-${key} ap-target-key-${key} ap-plugin-key-${extensionKey}`;
|
|
106
|
+
const optionsForWebItem = WebItemUtils.getOptionsForWebItem($target, cssClass);
|
|
107
|
+
expect(optionsForWebItem.someKey).toEqual(dialogOptions.options.someKey);
|
|
108
|
+
expect(optionsForWebItem.productContext).toEqual({});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('returns options of existing inline dialog webitem', () => {
|
|
112
|
+
const extensionKey = 'addonKey';
|
|
113
|
+
const key = 'moduleKey';
|
|
114
|
+
const $target = $('<div></div>');
|
|
115
|
+
const cssClass = `ap-inline-dialog ap-module-key-${key} ap-target-key-${key} ap-plugin-key-${extensionKey}`;
|
|
116
|
+
const optionsForWebItem = WebItemUtils.getOptionsForWebItem($target, cssClass);
|
|
117
|
+
expect(optionsForWebItem.someKey).toEqual(inlineDialogOptions.options.someKey);
|
|
118
|
+
expect(optionsForWebItem.productContext).toEqual({});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('returns empty options when not defined', () => {
|
|
122
|
+
const $target = $('<div></div>');
|
|
123
|
+
const cssClass = 'ap-inline-dialog ap-module-key-nothing ap-target-key-nothing ap-plugin-key-something';
|
|
124
|
+
const optionsForWebItem = WebItemUtils.getOptionsForWebItem($target, cssClass);
|
|
125
|
+
expect(optionsForWebItem).toEqual({productContext: {}, structuredContext: {}});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('returns options with product context', () => {
|
|
129
|
+
const extensionKey = 'addonKey';
|
|
130
|
+
const key = 'moduleWithCtxKey';
|
|
131
|
+
var hashFragment = encodeURI(JSON.stringify({
|
|
132
|
+
structuredContext: '{"project":{"key":"FDS","id":"10000"}}',
|
|
133
|
+
productCtx:'{"user.key":"admin","project.key":"FDS","key1":"val1","key2":"val2","user.id":"admin","issue.key":"FDS-12","issuetype.id":"10003"}'
|
|
134
|
+
}));
|
|
135
|
+
var urlAnchor = '#' + hashFragment;
|
|
136
|
+
const $target = $('<a href=""></a>').attr('href', urlAnchor);
|
|
137
|
+
const cssClass = `ap-module-key-${key} ap-target-key-${key} ap-plugin-key-${extensionKey}`;
|
|
138
|
+
const optionsForWebItem = WebItemUtils.getOptionsForWebItem($target, cssClass);
|
|
139
|
+
// from the global options
|
|
140
|
+
expect(optionsForWebItem.productContext['key1']).toEqual('val1');
|
|
141
|
+
expect(optionsForWebItem.productContext['key2']).toEqual('val2');
|
|
142
|
+
// from anchor params
|
|
143
|
+
expect(optionsForWebItem.productContext['user.key']).toEqual('admin');
|
|
144
|
+
expect(optionsForWebItem.productContext['project.key']).toEqual('FDS');
|
|
145
|
+
expect(optionsForWebItem.structuredContext).toEqual({
|
|
146
|
+
project: {
|
|
147
|
+
key: 'FDS',
|
|
148
|
+
id: '10000'
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const convertedOptions = WebItemUtils.getConfigFromTarget($target, cssClass);
|
|
152
|
+
expect(convertedOptions.options.productContext['issue.key']).toEqual('FDS-12');
|
|
153
|
+
expect(convertedOptions.options.productContext['project.key']).toEqual('FDS');
|
|
154
|
+
expect(convertedOptions.options.structuredContext.project.key).toEqual('FDS');
|
|
155
|
+
expect(convertedOptions.options.structuredContext.project.id).toEqual('10000');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('returns options with product context and explicit URL', () => {
|
|
159
|
+
const extensionKey = 'addonKey';
|
|
160
|
+
const key = 'moduleWithCtxKey';
|
|
161
|
+
var hashFragment = encodeURI(JSON.stringify({
|
|
162
|
+
structuredContext: '{"project":{"key":"FDS","id":"10000"}}',
|
|
163
|
+
productCtx:'{"user.key":"admin","project.key":"FDS","key1":"val1","key2":"val2","user.id":"admin","issue.key":"FDS-12","issuetype.id":"10003"}'
|
|
164
|
+
}));
|
|
165
|
+
var urlAnchor = '#' + hashFragment;
|
|
166
|
+
const $target = $('<a href=""></a>');
|
|
167
|
+
const cssClass = `ap-module-key-${key} ap-target-key-${key} ap-plugin-key-${extensionKey}`;
|
|
168
|
+
const optionsForWebItem = WebItemUtils.getOptionsForWebItem($target, cssClass, urlAnchor);
|
|
169
|
+
// from the global options
|
|
170
|
+
expect(optionsForWebItem.productContext['key1']).toEqual('val1');
|
|
171
|
+
expect(optionsForWebItem.productContext['key2']).toEqual('val2');
|
|
172
|
+
// from anchor params
|
|
173
|
+
expect(optionsForWebItem.productContext['user.key']).toEqual('admin');
|
|
174
|
+
expect(optionsForWebItem.productContext['project.key']).toEqual('FDS');
|
|
175
|
+
expect(optionsForWebItem.structuredContext).toEqual({
|
|
176
|
+
project: {
|
|
177
|
+
key: 'FDS',
|
|
178
|
+
id: '10000'
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
const convertedOptions = WebItemUtils.getConfigFromTarget($target, cssClass, urlAnchor);
|
|
182
|
+
expect(convertedOptions.options.productContext['issue.key']).toEqual('FDS-12');
|
|
183
|
+
expect(convertedOptions.options.productContext['project.key']).toEqual('FDS');
|
|
184
|
+
expect(convertedOptions.options.structuredContext.project.key).toEqual('FDS');
|
|
185
|
+
expect(convertedOptions.options.structuredContext.project.id).toEqual('10000');
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// test for legacy URL formats in the p2 plugin
|
|
189
|
+
it('returns options with product context for URLs without hash fragments', () => {
|
|
190
|
+
const extensionKey = 'addonKey';
|
|
191
|
+
const key = 'moduleWithCtxKey';
|
|
192
|
+
const $target = $('<a href="https://some.url.com?key3=val3&key4=val4"></a>');
|
|
193
|
+
const cssClass = `ap-module-key-${key} ap-target-key-${key} ap-plugin-key-${extensionKey}`;
|
|
194
|
+
const optionsForWebItem = WebItemUtils.getOptionsForWebItem($target, cssClass);
|
|
195
|
+
// from the global options
|
|
196
|
+
expect(optionsForWebItem.productContext['key1']).toEqual('val1');
|
|
197
|
+
expect(optionsForWebItem.productContext['key2']).toEqual('val2');
|
|
198
|
+
// from query params
|
|
199
|
+
expect(optionsForWebItem.productContext['key3']).toEqual('val3');
|
|
200
|
+
expect(optionsForWebItem.productContext['key4']).toEqual('val4');
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('returns options with product context for explicit URLs without hash fragments', () => {
|
|
204
|
+
const extensionKey = 'addonKey';
|
|
205
|
+
const key = 'moduleWithCtxKey';
|
|
206
|
+
const $target = $('<div></div>');
|
|
207
|
+
const cssClass = `ap-module-key-${key} ap-target-key-${key} ap-plugin-key-${extensionKey}`;
|
|
208
|
+
const href = 'https://some.url.com?key3=val3&key4=val4';
|
|
209
|
+
const optionsForWebItem = WebItemUtils.getOptionsForWebItem($target, cssClass, href);
|
|
210
|
+
// from the global options
|
|
211
|
+
expect(optionsForWebItem.productContext['key1']).toEqual('val1');
|
|
212
|
+
expect(optionsForWebItem.productContext['key2']).toEqual('val2');
|
|
213
|
+
// from query params
|
|
214
|
+
expect(optionsForWebItem.productContext['key3']).toEqual('val3');
|
|
215
|
+
expect(optionsForWebItem.productContext['key4']).toEqual('val4');
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
});
|
|
219
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import WebItem from 'src/host/components/webitem';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
|
|
4
|
+
describe('webitem component', () => {
|
|
5
|
+
|
|
6
|
+
describe('content resolver', () => {
|
|
7
|
+
|
|
8
|
+
it('contains a default content resolver', () => {
|
|
9
|
+
expect(WebItem._contentResolver).toEqual(jasmine.any(Function));
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('setContentResolver sets a content resolver', () => {
|
|
13
|
+
var resolver = jasmine.createSpy('spy');
|
|
14
|
+
WebItem.setContentResolver(resolver);
|
|
15
|
+
expect(WebItem._contentResolver).toEqual(resolver);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('requestContent calls the content resolver', () => {
|
|
19
|
+
var resolver = jasmine.createSpy('spy');
|
|
20
|
+
var extension = {
|
|
21
|
+
addon_key: 'some.addon.key',
|
|
22
|
+
key: 'any.module.key'
|
|
23
|
+
};
|
|
24
|
+
WebItem.setContentResolver(resolver);
|
|
25
|
+
WebItem.requestContent(extension);
|
|
26
|
+
expect(resolver).toHaveBeenCalled();
|
|
27
|
+
expect(resolver.calls.first().args[0]).toEqual({
|
|
28
|
+
addon_key: extension.addon_key,
|
|
29
|
+
key: extension.key,
|
|
30
|
+
classifier: 'json'
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('requestContent returns the content resolver return', () => {
|
|
35
|
+
var resolver = jasmine.createSpy('spy').and.returnValue('response');
|
|
36
|
+
var extension = {
|
|
37
|
+
addon_key: 'some.addon.key',
|
|
38
|
+
key: 'any.module.key'
|
|
39
|
+
};
|
|
40
|
+
WebItem.setContentResolver(resolver);
|
|
41
|
+
expect(WebItem.requestContent(extension)).toEqual('response');
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('setWebItem adds a webitem to the list', () => {
|
|
46
|
+
var webitemone = {
|
|
47
|
+
name: 'awebitem',
|
|
48
|
+
selector: 'div',
|
|
49
|
+
triggers: []
|
|
50
|
+
};
|
|
51
|
+
expect(WebItem._webitems).toEqual({});
|
|
52
|
+
WebItem.setWebItem(webitemone);
|
|
53
|
+
expect(WebItem._webitems).toEqual({
|
|
54
|
+
'awebitem': webitemone
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe('getWebItemsBySelector', () => {
|
|
59
|
+
afterEach(() => {
|
|
60
|
+
WebItem._webitems = {};
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('returns webitems that match the specified selector', () => {
|
|
64
|
+
var webitemone = {
|
|
65
|
+
name: 'awebitem',
|
|
66
|
+
selector: 'div',
|
|
67
|
+
triggers: []
|
|
68
|
+
};
|
|
69
|
+
var webitemtwo = {
|
|
70
|
+
name: 'secondwebitem',
|
|
71
|
+
selector: 'a',
|
|
72
|
+
triggers: []
|
|
73
|
+
};
|
|
74
|
+
WebItem.setWebItem(webitemone);
|
|
75
|
+
WebItem.setWebItem(webitemtwo);
|
|
76
|
+
|
|
77
|
+
var filtered = WebItem.getWebItemsBySelector('div');
|
|
78
|
+
expect(filtered).toEqual(webitemone);
|
|
79
|
+
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('AUI responsive webitems event', () => {
|
|
84
|
+
var oldWebItemId = 'old-web-item';
|
|
85
|
+
var newWebItemId = 'new-web-item';
|
|
86
|
+
var apClassList = ['ap-dialog', 'ap-module-test', 'ap-extension'];
|
|
87
|
+
var nonApClassList = ['aui-nav', 'aui-something', 'not-ap'];
|
|
88
|
+
|
|
89
|
+
afterEach(() => {
|
|
90
|
+
$(`#${oldWebItemId}`).remove();
|
|
91
|
+
$(`#${newWebItemId}`).remove();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('adds ap classes to the sub menu web items', () => {
|
|
95
|
+
|
|
96
|
+
$('body').append($(`<li id="${oldWebItemId}"><a href="https://some.url.com" class="${nonApClassList.join(' ')} ${apClassList.join(' ')}">test</a></li>`));
|
|
97
|
+
$('body').append($(`<li id="${newWebItemId}"><a href="https://some.url.com">test</a></li>`));
|
|
98
|
+
|
|
99
|
+
var oldWebItem = document.getElementById(oldWebItemId);
|
|
100
|
+
var newWebItem = document.getElementById(newWebItemId);
|
|
101
|
+
|
|
102
|
+
var testEvent;
|
|
103
|
+
if (typeof Event === 'function') {
|
|
104
|
+
testEvent = new Event('aui-responsive-menu-item-created');
|
|
105
|
+
testEvent.detail = {
|
|
106
|
+
originalItem: oldWebItem,
|
|
107
|
+
newItem: newWebItem
|
|
108
|
+
};
|
|
109
|
+
document.dispatchEvent(testEvent);
|
|
110
|
+
} else {
|
|
111
|
+
var testEvent = document.createEvent('Event');
|
|
112
|
+
testEvent.initEvent('aui-responsive-menu-item-created', false, false);
|
|
113
|
+
testEvent.detail = {
|
|
114
|
+
originalItem: oldWebItem,
|
|
115
|
+
newItem: newWebItem
|
|
116
|
+
};
|
|
117
|
+
document.dispatchEvent(testEvent);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
var newWebItemLink = newWebItem.querySelector('a');
|
|
121
|
+
|
|
122
|
+
apClassList.forEach((cls) => {
|
|
123
|
+
expect(_.includes(newWebItemLink.classList, cls)).toBe(true);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
nonApClassList.forEach((cls) => {
|
|
127
|
+
expect(_.includes(newWebItemLink.classList, cls)).toBe(false);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
.ap-stats {
|
|
2
|
+
padding: 0px 10px;
|
|
3
|
+
background-color: #f5f5f5;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ap-dialog-container .ap-container,
|
|
7
|
+
.ap-aui-dialog2 div {
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ap-aui-dialog2 div.ap-stats {
|
|
12
|
+
height: auto;
|
|
13
|
+
position: absolute; /* go over the top of the bottom bar when visible */
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* add new aui dialog size of fullscreen */
|
|
17
|
+
.ap-aui-dialog2.aui-dialog2-fullscreen {
|
|
18
|
+
/*
|
|
19
|
+
https://jira.atlassian.com/browse/CONFCLOUD-73967
|
|
20
|
+
We couldn't find how this issue started happening, it might have been there for some time but noone noticed it before.
|
|
21
|
+
Adding !important to increase priority of this over .aui-dialog2.aui-layer
|
|
22
|
+
*/
|
|
23
|
+
top: 0 !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* add new aui dialog size of maximum */
|
|
27
|
+
.ap-aui-dialog2.aui-dialog2-maximum {
|
|
28
|
+
top: 0 !important;
|
|
29
|
+
height: 100%;
|
|
30
|
+
}
|
|
31
|
+
.ap-aui-dialog2.aui-dialog2-maximum .aui-dialog2-content {
|
|
32
|
+
height: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ap-aui-dialog2 .aui-dialog2-content {
|
|
36
|
+
padding:0;
|
|
37
|
+
|
|
38
|
+
/* in chrome'd dialogs - fixes scrollbars added by iframes with scrollbars pushing the width out */
|
|
39
|
+
overflow:hidden;
|
|
40
|
+
|
|
41
|
+
/* in safari, chromeless dialogs become invisible, because apparently GPU FTW */
|
|
42
|
+
-webkit-transform: translatez(0);
|
|
43
|
+
will-change: opacity, visibility;
|
|
44
|
+
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ap-aui-dialog2 iframe {
|
|
50
|
+
display:block;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ap-aui-dialog2.aui-dialog2-chromeless .aui-dialog2-content {
|
|
54
|
+
background-color:transparent;
|
|
55
|
+
|
|
56
|
+
/* Override the aui selector that assumes the last-child is the footer */
|
|
57
|
+
border-radius: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ap-aui-dialog2 .ap-status-indicator {
|
|
61
|
+
padding: 5px 10px;
|
|
62
|
+
background: transparent;
|
|
63
|
+
position: absolute;
|
|
64
|
+
top: 10px;
|
|
65
|
+
width: 100%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ap-aui-dialog2.aui-dialog2-maximum .ap-status-indicator,
|
|
69
|
+
.ap-aui-dialog2.aui-dialog2-chromeless .ap-status-indicator {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ap-aui-dialog2 .ap-stats {
|
|
74
|
+
display: block;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* header controls */
|
|
78
|
+
/*
|
|
79
|
+
These styles lifted from the file viewer. We could conceivably define a separate component 'header-controls'
|
|
80
|
+
in AUI that contains its own styles, but adding to AUI is out of scope for the current task.
|
|
81
|
+
|
|
82
|
+
Given that plugin devs won't be working directly with these CSS rules, we have some flexibility to refactor
|
|
83
|
+
these internals later.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
.ap-header-controls.aui-dialog2 .aui-dialog2-header {
|
|
87
|
+
background-color: #000;
|
|
88
|
+
border-radius: 0;
|
|
89
|
+
height: 50px;
|
|
90
|
+
margin-top: 0;
|
|
91
|
+
padding: 0 0 0 20px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.ap-header-controls .header-title-container {
|
|
95
|
+
max-width: 70%;
|
|
96
|
+
display: block;
|
|
97
|
+
float: left;
|
|
98
|
+
height: 50px
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.ap-header-controls .header-title-container div {
|
|
102
|
+
color: #fff;
|
|
103
|
+
line-height: 50px;
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
overflow: hidden
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.ap-header-controls .header-control-panel {
|
|
109
|
+
padding-left: 0;
|
|
110
|
+
text-align: right;
|
|
111
|
+
float: right;
|
|
112
|
+
max-width: 30%;
|
|
113
|
+
display: block;
|
|
114
|
+
height: 50px
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ap-header-controls .header-control-panel > span {
|
|
118
|
+
display: inline-block
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.ap-header-controls .header-control-panel .aui-button {
|
|
122
|
+
background-color: #000; /* Override blue for primary controls*/
|
|
123
|
+
background-position: center;
|
|
124
|
+
background-repeat: no-repeat;
|
|
125
|
+
border-left: 1px solid #333;
|
|
126
|
+
border-radius: 0px;
|
|
127
|
+
height: 50px;
|
|
128
|
+
float: left;
|
|
129
|
+
margin-left: 0; /* overrides AUI style of 10px */
|
|
130
|
+
text-align: left;
|
|
131
|
+
text-indent: -999em;
|
|
132
|
+
width: 50px
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Pads the button icons provided by the AUI Icon font */
|
|
136
|
+
.ap-header-controls .header-control-panel .aui-icon-small:before {
|
|
137
|
+
color: #fff;
|
|
138
|
+
margin-left: 16px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* Reduce the height of the content div to allow for the height of the header bar */
|
|
142
|
+
.ap-header-controls .aui-dialog2-content {
|
|
143
|
+
max-height: calc(100% - 50px);
|
|
144
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.ap-status-indicator {
|
|
2
|
+
padding-top: 5px;
|
|
3
|
+
font-size: 12px;
|
|
4
|
+
line-height: 1.42857142857143;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ap-status-indicator small {
|
|
8
|
+
color: #707070;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ap-loading, .ap-load-timeout {
|
|
12
|
+
padding-left: 4px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ap-link-disabled, .ap-link-disabled:hover, .ap-link-disabled:visited, .ap-link-disabled:focus {
|
|
16
|
+
color: gray !important;
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ap-iframe-container iframe {
|
|
21
|
+
border: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ap-iframe-container iframe.full-size-general-page {
|
|
25
|
+
border-bottom: 1px solid #ccc;
|
|
26
|
+
}
|
|
27
|
+
.ap-iframe-container iframe.full-size-general-page-no-footer {
|
|
28
|
+
border:none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
iframe.sized-to-parent {
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ap-status-indicator .small-spinner {
|
|
36
|
+
width: 20px;
|
|
37
|
+
height: 20px;
|
|
38
|
+
float: left;
|
|
39
|
+
margin-right: 4px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ap-iframe-container {
|
|
43
|
+
line-height: 0;
|
|
44
|
+
margin: 0;
|
|
45
|
+
padding: 0;
|
|
46
|
+
font-size: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@-webkit-keyframes fadeInConnectSpinner { from { opacity: 0; } to { opacity: 1; } }
|
|
50
|
+
@-moz-keyframes fadeInConnectSpinner { from { opacity: 0; } to { opacity: 1; } }
|
|
51
|
+
@-o-keyframes fadeInConnectSpinner { from { opacity: 0; } to { opacity: 1; } }
|
|
52
|
+
@keyframes fadeInConnectSpinner { from { opacity: 0; } to { opacity: 1; } }
|
|
53
|
+
|
|
54
|
+
.ap-status-indicator {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
animation: fadeInConnectSpinner 0.5s ease-in;
|
|
57
|
+
animation-delay: 1s;
|
|
58
|
+
animation-fill-mode: forwards;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.connect-resolve-error {
|
|
62
|
+
font-size: 12px;
|
|
63
|
+
line-height: 1.42857142857143;
|
|
64
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* Copied from https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence/browse/confluence-plugins/confluence-bundled-plugins/confluence-web-resources/src/main/resources/includes/css/theming/legacy-text-colors.less
|
|
2
|
+
* Removed unneeded *-color-picker classes
|
|
3
|
+
*/
|
|
4
|
+
/* stylelint-disable design-system/ensure-design-token-usage */
|
|
5
|
+
.legacy-text-color(@name, @originalColor, @darkColor) {
|
|
6
|
+
.legacy-color-text-@{name} {
|
|
7
|
+
color: @originalColor;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
html[data-color-mode=dark] .legacy-color-text-@{name} {
|
|
11
|
+
color: @darkColor;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.legacy-text-color(blue3, #172B4D, #B6C2CF);
|
|
16
|
+
.legacy-text-color(orange1, #993300, #EF7B46);
|
|
17
|
+
.legacy-text-color(khaki1, #333300, #CDC991);
|
|
18
|
+
.legacy-text-color(green1, #003300, #A9DCA0);
|
|
19
|
+
.legacy-text-color(blue1, #003366, #ABC3FF);
|
|
20
|
+
.legacy-text-color(blue2, #000080, #F2BFFF);
|
|
21
|
+
.legacy-text-color(purple1, #333399, #B3A0FF);
|
|
22
|
+
.legacy-text-color(default, #000000, #FFFFFF);
|
|
23
|
+
.legacy-text-color(red1, #800000, #FF8F73);
|
|
24
|
+
.legacy-text-color(orange2, #FF6600, #FF944D);
|
|
25
|
+
.legacy-text-color(yellow1, #808000, #949400);
|
|
26
|
+
.legacy-text-color(green2, #008000, #4A9A4A);
|
|
27
|
+
.legacy-text-color(teal1, #008080, #2DA8A8);
|
|
28
|
+
.legacy-text-color(blue4, #0000FF, #8080FF);
|
|
29
|
+
.legacy-text-color(gray1, #666699, #9B9BC5);
|
|
30
|
+
.legacy-text-color(gray2, #7A869A, #8893A5);
|
|
31
|
+
.legacy-text-color(red2, #FF0000, #FF3D3D);
|
|
32
|
+
.legacy-text-color(orange3, #FF9900, #FFC266);
|
|
33
|
+
.legacy-text-color(green3, #99CC00, #AACC43);
|
|
34
|
+
.legacy-text-color(green4, #339966, #53C68C);
|
|
35
|
+
.legacy-text-color(teal2, #33CCCC, #8DE2E2);
|
|
36
|
+
.legacy-text-color(blue5, #3366FF, #7094FF);
|
|
37
|
+
.legacy-text-color(pink1, #800080, #F380EE);
|
|
38
|
+
.legacy-text-color(gray3, #A5ADBA, #A5ADBA);
|
|
39
|
+
.legacy-text-color(pink2, #FF00FF, #FF80FF);
|
|
40
|
+
.legacy-text-color(yellow2, #FFCC00, #FFEA94);
|
|
41
|
+
.legacy-text-color(yellow3, #FFFF00, #FFFF6B);
|
|
42
|
+
.legacy-text-color(green5, #00FF00, #61FF61);
|
|
43
|
+
.legacy-text-color(teal3, #00FFFF, #57FFFF);
|
|
44
|
+
.legacy-text-color(blue6, #00CCFF, #57DDFF);
|
|
45
|
+
.legacy-text-color(pink3, #993366, #DE73A3);
|
|
46
|
+
.legacy-text-color(gray4, #C1C7D0, #C1C7D0);
|
|
47
|
+
.legacy-text-color(pink4, #FF99CC, #E5579E);
|
|
48
|
+
.legacy-text-color(tan1, #FFCC99, #FFA347);
|
|
49
|
+
.legacy-text-color(yellow4, #FFFF99, #E5E545);
|
|
50
|
+
.legacy-text-color(green6, #CCFFCC, #61D661);
|
|
51
|
+
.legacy-text-color(teal4, #CCFFFF, #8AFFFF);
|
|
52
|
+
.legacy-text-color(blue7, #99CCFF, #56ABFF);
|
|
53
|
+
.legacy-text-color(purple2, #CC99FF, #BA75FF);
|
|
54
|
+
.legacy-text-color(inverse, #FFFFFF, #000000);
|
|
55
|
+
/* stylelint-enable design-system/ensure-design-token-usage */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
html[data-surface="overlay"] {
|
|
2
|
+
--ds-elevation-surface-current: var(--ds-surface-overlay);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
html[data-surface="raised"] {
|
|
6
|
+
--ds-elevation-surface-current: var(--ds-surface-raised);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
html[data-surface="sunken"] {
|
|
10
|
+
--ds-elevation-surface-current: var(--ds-surface-sunken);
|
|
11
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
// This is essentially a copy of the ACJSFrameworkAdaptor/BaseFrameworkAdaptor implementation generated
|
|
3
|
+
// by compiling the connect-module-core typescript implementations of the equivalent classes.
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This class provides common behaviour relating to the adaption of functionality to a
|
|
7
|
+
* particular Connect client framework. This is necessary for an interim period during which
|
|
8
|
+
* we have multiple Connect client frameworks that we need to support: ACJS and CaaS Client.
|
|
9
|
+
*/
|
|
10
|
+
var ACJSFrameworkAdaptor = (function () {
|
|
11
|
+
function ACJSFrameworkAdaptor() {
|
|
12
|
+
this.moduleNamesToModules = new Map();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This method registers a module with the Connect client framework relating to this adaptor instance.
|
|
16
|
+
* @param moduleDefinition the definition of the module.
|
|
17
|
+
*/
|
|
18
|
+
ACJSFrameworkAdaptor.prototype.registerModule = function (module, props) {
|
|
19
|
+
var moduleRegistrationName = module.getModuleRegistrationName();
|
|
20
|
+
this.moduleNamesToModules.set(moduleRegistrationName, module);
|
|
21
|
+
|
|
22
|
+
// This adaptor implementation doesn't need to register the SimpleXDM definition so the following is
|
|
23
|
+
// commented out.
|
|
24
|
+
//
|
|
25
|
+
// var simpleXdmDefinition = module.getSimpleXdmDefinition(props);
|
|
26
|
+
// this.registerModuleWithHost(moduleRegistrationName, simpleXdmDefinition);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
ACJSFrameworkAdaptor.prototype.getModuleByName = function (moduleName) {
|
|
30
|
+
return this.moduleNamesToModules.get(moduleName);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
ACJSFrameworkAdaptor.prototype.getProviderByModuleName = function (moduleName) {
|
|
34
|
+
var module = this.moduleNamesToModules.get(moduleName);
|
|
35
|
+
if (module && module.isEnabled()) {
|
|
36
|
+
return module.getProvider();
|
|
37
|
+
} else {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return ACJSFrameworkAdaptor;
|
|
42
|
+
}());
|
|
43
|
+
|
|
44
|
+
export const acjsFrameworkAdaptor = new ACJSFrameworkAdaptor();
|