@atlaskit/side-navigation 3.2.1 → 3.3.0
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/CHANGELOG.md +14 -1
- package/README.md +7 -3
- package/codemods/0.8.0-change-css-fn-prop.tsx +136 -164
- package/codemods/__tests__/0.8.0-change-css-fn-prop.tsx +77 -77
- package/codemods/helpers/generic.tsx +528 -564
- package/constellation/index/examples.mdx +20 -20
- package/constellation/index/props.mdx +8 -8
- package/constellation/index/usage.mdx +27 -11
- package/dist/cjs/components/Header/index.js +4 -0
- package/dist/cjs/components/Item/link-item.js +3 -1
- package/dist/cjs/components/LoadingItems/index.js +7 -3
- package/dist/cjs/components/NavigationContent/index.js +8 -1
- package/dist/cjs/components/NavigationHeader/index.js +4 -0
- package/dist/cjs/components/NestableNavigationContent/index.js +5 -0
- package/dist/cjs/components/NestableNavigationContent/nesting-motion.js +3 -1
- package/dist/cjs/components/NestingItem/index.js +4 -0
- package/dist/cjs/components/SideNavigation/index.js +5 -0
- package/dist/es2019/components/Header/index.js +5 -0
- package/dist/es2019/components/Item/link-item.js +3 -1
- package/dist/es2019/components/LoadingItems/index.js +7 -3
- package/dist/es2019/components/NavigationContent/index.js +8 -1
- package/dist/es2019/components/NavigationHeader/index.js +4 -0
- package/dist/es2019/components/NestableNavigationContent/index.js +5 -0
- package/dist/es2019/components/NestableNavigationContent/nesting-motion.js +4 -0
- package/dist/es2019/components/NestingItem/index.js +5 -0
- package/dist/es2019/components/SideNavigation/index.js +5 -0
- package/dist/esm/components/Header/index.js +5 -0
- package/dist/esm/components/Item/link-item.js +3 -1
- package/dist/esm/components/LoadingItems/index.js +7 -3
- package/dist/esm/components/NavigationContent/index.js +8 -1
- package/dist/esm/components/NavigationHeader/index.js +4 -0
- package/dist/esm/components/NestableNavigationContent/index.js +5 -0
- package/dist/esm/components/NestableNavigationContent/nesting-motion.js +4 -0
- package/dist/esm/components/NestingItem/index.js +5 -0
- package/dist/esm/components/SideNavigation/index.js +5 -0
- package/dist/types/components/LoadingItems/index.d.ts +1 -1
- package/dist/types/components/NavigationContent/index.d.ts +3 -0
- package/dist/types/components/NavigationHeader/index.d.ts +3 -0
- package/dist/types/components/NestableNavigationContent/nesting-motion.d.ts +3 -0
- package/dist/types/components/NestingItem/index.d.ts +3 -0
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types-ts4.5/components/LoadingItems/index.d.ts +1 -1
- package/dist/types-ts4.5/components/NavigationContent/index.d.ts +3 -0
- package/dist/types-ts4.5/components/NavigationHeader/index.d.ts +3 -0
- package/dist/types-ts4.5/components/NestableNavigationContent/nesting-motion.d.ts +3 -0
- package/dist/types-ts4.5/components/NestingItem/index.d.ts +3 -0
- package/dist/types-ts4.5/components/index.d.ts +2 -2
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/docs/00-intro.tsx +4 -6
- package/docs/ert/footer.tsx +6 -6
- package/package.json +97 -97
- package/report.api.md +102 -123
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/side-navigation
|
|
2
2
|
|
|
3
|
+
## 3.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#110836](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110836)
|
|
8
|
+
[`a8bd419fd70b9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a8bd419fd70b9) -
|
|
9
|
+
Explicitly set jsxRuntime to classic via pragma comments in order to avoid issues where jsxRuntime
|
|
10
|
+
is implicitly set to automatic.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 3.2.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -43,7 +56,7 @@
|
|
|
43
56
|
|
|
44
57
|
- [#94389](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94389)
|
|
45
58
|
[`5ca1173e141e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ca1173e141e) -
|
|
46
|
-
Add support for React 18.
|
|
59
|
+
Add support for React 18 in non-strict mode.
|
|
47
60
|
|
|
48
61
|
## 3.0.10
|
|
49
62
|
|
package/README.md
CHANGED
|
@@ -10,7 +10,11 @@ yarn add @atlaskit/side-navigation
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
Detailed docs and example usage can be found
|
|
13
|
+
Detailed docs and example usage can be found
|
|
14
|
+
[here](https://atlassian.design/components/side-navigation).
|
|
14
15
|
|
|
15
|
-
To add a top navigation, use
|
|
16
|
-
|
|
16
|
+
To add a top navigation, use
|
|
17
|
+
[@atlaskit/atlassian-navigation](https://atlassian.design/components/atlassian-navigation) To
|
|
18
|
+
control the layout of these navigation elements and add expand/collapse functionality to
|
|
19
|
+
`side-navigation`, use
|
|
20
|
+
[@atlaskit/page-layout](https://atlaskit.atlassian.com/packages/design-system/page-layout).
|
|
@@ -1,185 +1,157 @@
|
|
|
1
1
|
import { type NodePath } from 'ast-types/lib/node-path';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
type API,
|
|
4
|
+
type ASTPath,
|
|
5
|
+
type default as core,
|
|
6
|
+
type FileInfo,
|
|
7
|
+
type ImportDeclaration,
|
|
8
|
+
type ImportSpecifier,
|
|
9
|
+
type Options,
|
|
10
10
|
} from 'jscodeshift';
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.find(j.JSXAttribute)
|
|
25
|
-
.filter((attribute) => {
|
|
26
|
-
const matches = j(attribute)
|
|
27
|
-
.find(j.JSXIdentifier)
|
|
28
|
-
.filter((identifier) => identifier.value.name === attributeName);
|
|
29
|
-
return Boolean(matches.length);
|
|
30
|
-
});
|
|
12
|
+
import { addCommentBeforeJSX, getDefaultSpecifierName } from './helpers/generic';
|
|
13
|
+
|
|
14
|
+
function getJSXAttributesByName(j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) {
|
|
15
|
+
return j(element)
|
|
16
|
+
.find(j.JSXOpeningElement)
|
|
17
|
+
.find(j.JSXAttribute)
|
|
18
|
+
.filter((attribute) => {
|
|
19
|
+
const matches = j(attribute)
|
|
20
|
+
.find(j.JSXIdentifier)
|
|
21
|
+
.filter((identifier) => identifier.value.name === attributeName);
|
|
22
|
+
return Boolean(matches.length);
|
|
23
|
+
});
|
|
31
24
|
}
|
|
32
25
|
|
|
33
26
|
function getImportSpecifier(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
j: core.JSCodeshift,
|
|
28
|
+
source: ReturnType<typeof j>,
|
|
29
|
+
specifier: string,
|
|
30
|
+
imported: string,
|
|
38
31
|
) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (!specifiers.length) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return specifiers.nodes()[0]!.local!.name;
|
|
32
|
+
const specifiers = source
|
|
33
|
+
.find(j.ImportDeclaration)
|
|
34
|
+
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
|
|
35
|
+
.find(j.ImportSpecifier)
|
|
36
|
+
.filter((path: ASTPath<ImportSpecifier>) => path.value.imported.name === imported);
|
|
37
|
+
|
|
38
|
+
if (!specifiers.length) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return specifiers.nodes()[0]!.local!.name;
|
|
55
43
|
}
|
|
56
44
|
|
|
57
|
-
function updateCssFnProp(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
cssFnExpression!.value.params.shift();
|
|
102
|
-
} catch (e) {
|
|
103
|
-
addCommentBeforeJSX(
|
|
104
|
-
j,
|
|
105
|
-
cssFnProp,
|
|
106
|
-
`
|
|
45
|
+
function updateCssFnProp(j: core.JSCodeshift, source: ReturnType<typeof j>, specifier: string) {
|
|
46
|
+
source.findJSXElements(specifier).forEach((element) => {
|
|
47
|
+
const cssFnPropCollection = getJSXAttributesByName(j, element, 'cssFn');
|
|
48
|
+
|
|
49
|
+
// no cssProp usage for this element
|
|
50
|
+
if (!cssFnPropCollection.length) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const cssFnProp = cssFnPropCollection.get();
|
|
55
|
+
|
|
56
|
+
const cssFnExpression: NodePath = j(cssFnProp)
|
|
57
|
+
.find(j.JSXExpressionContainer)
|
|
58
|
+
.find(j.Expression)
|
|
59
|
+
.get();
|
|
60
|
+
|
|
61
|
+
if (cssFnExpression) {
|
|
62
|
+
// just remove the state styles param
|
|
63
|
+
try {
|
|
64
|
+
const [stylePropName] = cssFnExpression!.value.params;
|
|
65
|
+
j(cssFnExpression)
|
|
66
|
+
.find(j.SpreadElement)
|
|
67
|
+
.forEach((n) => {
|
|
68
|
+
// discerns whether there are multiple identifiers here
|
|
69
|
+
const isComplexIdentifier = j(n).find(j.Identifier).length > 1;
|
|
70
|
+
|
|
71
|
+
if (isComplexIdentifier) {
|
|
72
|
+
throw new Error('CSSFn Prop codemod: Unable to parse spread element');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const hasStyleProp = !!j(n)
|
|
76
|
+
.find(j.Identifier)
|
|
77
|
+
.filter((node) => node.value.name === stylePropName.name).length;
|
|
78
|
+
if (hasStyleProp) {
|
|
79
|
+
j(n).remove();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
cssFnExpression!.value.params.shift();
|
|
84
|
+
} catch (e) {
|
|
85
|
+
addCommentBeforeJSX(
|
|
86
|
+
j,
|
|
87
|
+
cssFnProp,
|
|
88
|
+
`
|
|
107
89
|
The usage of the 'cssFn' prop in this component could not be transformed and requires manual intervention.
|
|
108
90
|
The 'cssFn' prop has been simplified so that users no longer need to merge the inherited styles with their own overrides.
|
|
109
91
|
For more info please reach out to #help-design-system-code.
|
|
110
92
|
`,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
115
97
|
}
|
|
116
98
|
|
|
117
99
|
function hasImportDeclaration(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
100
|
+
j: core.JSCodeshift,
|
|
101
|
+
source: ReturnType<typeof j>,
|
|
102
|
+
importPath: string,
|
|
121
103
|
) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.filter((path) => path.node.source.value === importPath).length;
|
|
104
|
+
return !!source.find(j.ImportDeclaration).filter((path) => path.node.source.value === importPath)
|
|
105
|
+
.length;
|
|
125
106
|
}
|
|
126
107
|
|
|
127
|
-
export default function transformer(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return source.toSource(
|
|
177
|
-
options.printOptions || {
|
|
178
|
-
quote: 'single',
|
|
179
|
-
trailingComma: true,
|
|
180
|
-
},
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return fileInfo.source;
|
|
108
|
+
export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
109
|
+
const source = j(fileInfo.source);
|
|
110
|
+
|
|
111
|
+
if (hasImportDeclaration(j, source, '@atlaskit/side-navigation')) {
|
|
112
|
+
const defaultSpecifier = getDefaultSpecifierName({
|
|
113
|
+
j,
|
|
114
|
+
base: source,
|
|
115
|
+
packageName: '@atlaskit/side-navigation',
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
if (defaultSpecifier != null) {
|
|
119
|
+
updateCssFnProp(j, source, defaultSpecifier);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
[
|
|
123
|
+
'SideNavigation',
|
|
124
|
+
'Header',
|
|
125
|
+
'NavigationHeader',
|
|
126
|
+
'NavigationContent',
|
|
127
|
+
'Section',
|
|
128
|
+
'HeadingItem',
|
|
129
|
+
'SkeletonHeadingItem',
|
|
130
|
+
'NestableNavigationContent',
|
|
131
|
+
'NestingItem',
|
|
132
|
+
'ButtonItem',
|
|
133
|
+
'LinkItem',
|
|
134
|
+
'GoBackItem',
|
|
135
|
+
'CustomItem',
|
|
136
|
+
'SkeletonItem',
|
|
137
|
+
'Footer',
|
|
138
|
+
'NavigationFooter',
|
|
139
|
+
'LoadingItems',
|
|
140
|
+
].forEach((pkg) => {
|
|
141
|
+
const importSpecifier = getImportSpecifier(j, source, '@atlaskit/side-navigation', pkg);
|
|
142
|
+
|
|
143
|
+
if (importSpecifier != null) {
|
|
144
|
+
updateCssFnProp(j, source, importSpecifier);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
return source.toSource(
|
|
149
|
+
options.printOptions || {
|
|
150
|
+
quote: 'single',
|
|
151
|
+
trailingComma: true,
|
|
152
|
+
},
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return fileInfo.source;
|
|
185
157
|
}
|
|
@@ -5,30 +5,30 @@ import * as transformer from '../0.8.0-change-css-fn-prop';
|
|
|
5
5
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
6
|
|
|
7
7
|
describe('Updates and removes current inline styles', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
defineInlineTest(
|
|
9
|
+
{ ...transformer, parser: 'tsx' },
|
|
10
|
+
{},
|
|
11
|
+
`
|
|
12
12
|
import { ButtonItem } from '@atlaskit/something';
|
|
13
13
|
|
|
14
14
|
const App = () => {
|
|
15
15
|
return <ButtonItem />;
|
|
16
16
|
}
|
|
17
17
|
`,
|
|
18
|
-
|
|
18
|
+
`
|
|
19
19
|
import { ButtonItem } from '@atlaskit/something';
|
|
20
20
|
|
|
21
21
|
const App = () => {
|
|
22
22
|
return <ButtonItem />;
|
|
23
23
|
}
|
|
24
24
|
`,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
'leaves unrelated code untouched',
|
|
26
|
+
);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
defineInlineTest(
|
|
29
|
+
{ ...transformer, parser: 'tsx' },
|
|
30
|
+
{},
|
|
31
|
+
`
|
|
32
32
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
33
33
|
|
|
34
34
|
const App = () => {
|
|
@@ -37,7 +37,7 @@ describe('Updates and removes current inline styles', () => {
|
|
|
37
37
|
})} />;
|
|
38
38
|
}
|
|
39
39
|
`,
|
|
40
|
-
|
|
40
|
+
`
|
|
41
41
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
42
42
|
|
|
43
43
|
const App = () => {
|
|
@@ -48,13 +48,13 @@ describe('Updates and removes current inline styles', () => {
|
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
`,
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
'should remove current styles from inline function',
|
|
52
|
+
);
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
defineInlineTest(
|
|
55
|
+
{ ...transformer, parser: 'tsx' },
|
|
56
|
+
{},
|
|
57
|
+
`
|
|
58
58
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
59
59
|
|
|
60
60
|
const App = () => {
|
|
@@ -72,7 +72,7 @@ describe('Updates and removes current inline styles', () => {
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
`,
|
|
75
|
-
|
|
75
|
+
`
|
|
76
76
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
77
77
|
|
|
78
78
|
const App = () => {
|
|
@@ -87,13 +87,13 @@ describe('Updates and removes current inline styles', () => {
|
|
|
87
87
|
);
|
|
88
88
|
};
|
|
89
89
|
`,
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
'should remove current styles from scope',
|
|
91
|
+
);
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
defineInlineTest(
|
|
94
|
+
{ ...transformer, parser: 'tsx' },
|
|
95
|
+
{},
|
|
96
|
+
`
|
|
97
97
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
98
98
|
|
|
99
99
|
const App = () => {
|
|
@@ -103,7 +103,7 @@ describe('Updates and removes current inline styles', () => {
|
|
|
103
103
|
})} />;
|
|
104
104
|
}
|
|
105
105
|
`,
|
|
106
|
-
|
|
106
|
+
`
|
|
107
107
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
108
108
|
|
|
109
109
|
const App = () => {
|
|
@@ -114,13 +114,13 @@ describe('Updates and removes current inline styles', () => {
|
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
`,
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
'correctly removes spread styles',
|
|
118
|
+
);
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
defineInlineTest(
|
|
121
|
+
{ ...transformer, parser: 'tsx' },
|
|
122
|
+
{},
|
|
123
|
+
`
|
|
124
124
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
125
125
|
|
|
126
126
|
const App = () => {
|
|
@@ -134,7 +134,7 @@ describe('Updates and removes current inline styles', () => {
|
|
|
134
134
|
})} />;
|
|
135
135
|
}
|
|
136
136
|
`,
|
|
137
|
-
|
|
137
|
+
`
|
|
138
138
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
139
139
|
|
|
140
140
|
const App = () => {
|
|
@@ -149,13 +149,13 @@ describe('Updates and removes current inline styles', () => {
|
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
`,
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
'correctly removes spread styles with pseudo-selector access',
|
|
153
|
+
);
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
defineInlineTest(
|
|
156
|
+
{ ...transformer, parser: 'tsx' },
|
|
157
|
+
{},
|
|
158
|
+
`
|
|
159
159
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
160
160
|
|
|
161
161
|
const App = () => {
|
|
@@ -167,7 +167,7 @@ describe('Updates and removes current inline styles', () => {
|
|
|
167
167
|
);
|
|
168
168
|
}
|
|
169
169
|
`,
|
|
170
|
-
|
|
170
|
+
`
|
|
171
171
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
172
172
|
|
|
173
173
|
const App = () => {
|
|
@@ -185,13 +185,13 @@ describe('Updates and removes current inline styles', () => {
|
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
187
|
`,
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
'fail smoothly if the current styles are being used in a non-trivial way',
|
|
189
|
+
);
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
defineInlineTest(
|
|
192
|
+
{ ...transformer, parser: 'tsx' },
|
|
193
|
+
{},
|
|
194
|
+
`
|
|
195
195
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
196
196
|
|
|
197
197
|
const App = () => {
|
|
@@ -200,7 +200,7 @@ describe('Updates and removes current inline styles', () => {
|
|
|
200
200
|
})} />;
|
|
201
201
|
}
|
|
202
202
|
`,
|
|
203
|
-
|
|
203
|
+
`
|
|
204
204
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
205
205
|
|
|
206
206
|
const App = () => {
|
|
@@ -209,13 +209,13 @@ describe('Updates and removes current inline styles', () => {
|
|
|
209
209
|
})} />;
|
|
210
210
|
}
|
|
211
211
|
`,
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
'not change anything if user is not using the current state or styles',
|
|
213
|
+
);
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
defineInlineTest(
|
|
216
|
+
{ ...transformer, parser: 'tsx' },
|
|
217
|
+
{},
|
|
218
|
+
`
|
|
219
219
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
220
220
|
|
|
221
221
|
const App = () => {
|
|
@@ -230,7 +230,7 @@ describe('Updates and removes current inline styles', () => {
|
|
|
230
230
|
</ButtonItem>;
|
|
231
231
|
}
|
|
232
232
|
`,
|
|
233
|
-
|
|
233
|
+
`
|
|
234
234
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
235
235
|
|
|
236
236
|
const App = () => {
|
|
@@ -245,35 +245,35 @@ describe('Updates and removes current inline styles', () => {
|
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
`,
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
'should remove styles in nested children',
|
|
249
|
+
);
|
|
250
250
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
251
|
+
defineInlineTest(
|
|
252
|
+
{ ...transformer, parser: 'tsx' },
|
|
253
|
+
{},
|
|
254
|
+
`
|
|
255
255
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
256
256
|
|
|
257
257
|
const App = () => {
|
|
258
258
|
return <ButtonItem />;
|
|
259
259
|
}
|
|
260
260
|
`,
|
|
261
|
-
|
|
261
|
+
`
|
|
262
262
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
263
263
|
|
|
264
264
|
const App = () => {
|
|
265
265
|
return <ButtonItem />;
|
|
266
266
|
}
|
|
267
267
|
`,
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
'should leave affected items with no use of cssFn untouched',
|
|
269
|
+
);
|
|
270
270
|
});
|
|
271
271
|
|
|
272
272
|
describe('Updates and removes current styles', () => {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
defineInlineTest(
|
|
274
|
+
{ ...transformer, parser: 'tsx' },
|
|
275
|
+
{},
|
|
276
|
+
`
|
|
277
277
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
278
278
|
|
|
279
279
|
const cssFn = (styles, state) => ({
|
|
@@ -285,7 +285,7 @@ describe('Updates and removes current styles', () => {
|
|
|
285
285
|
return <ButtonItem cssFn={cssFn} />;
|
|
286
286
|
}
|
|
287
287
|
`,
|
|
288
|
-
|
|
288
|
+
`
|
|
289
289
|
import { ButtonItem } from '@atlaskit/side-navigation';
|
|
290
290
|
|
|
291
291
|
const cssFn = (styles, state) => ({
|
|
@@ -305,13 +305,13 @@ describe('Updates and removes current styles', () => {
|
|
|
305
305
|
);
|
|
306
306
|
}
|
|
307
307
|
`,
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
'should add prompt for non-inline function',
|
|
309
|
+
);
|
|
310
310
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
311
|
+
defineInlineTest(
|
|
312
|
+
{ ...transformer, parser: 'tsx' },
|
|
313
|
+
{},
|
|
314
|
+
`
|
|
315
315
|
import { ButtonItem, LinkItem } from '@atlaskit/side-navigation';
|
|
316
316
|
|
|
317
317
|
const cssFunction = (styles, state) => ({
|
|
@@ -327,7 +327,7 @@ describe('Updates and removes current styles', () => {
|
|
|
327
327
|
);
|
|
328
328
|
};
|
|
329
329
|
`,
|
|
330
|
-
|
|
330
|
+
`
|
|
331
331
|
import { ButtonItem, LinkItem } from '@atlaskit/side-navigation';
|
|
332
332
|
|
|
333
333
|
const cssFunction = (styles, state) => ({
|
|
@@ -355,6 +355,6 @@ describe('Updates and removes current styles', () => {
|
|
|
355
355
|
);
|
|
356
356
|
};
|
|
357
357
|
`,
|
|
358
|
-
|
|
359
|
-
|
|
358
|
+
'should add prompt for non-inline function to multiple instances',
|
|
359
|
+
);
|
|
360
360
|
});
|