Skip to content

Commit dc7645f

Browse files
committed
Add tests to kitchensink test suite
1 parent e48ed3e commit dc7645f

File tree

10 files changed

+106
-0
lines changed

10 files changed

+106
-0
lines changed

packages/react-scripts/fixtures/kitchensink/template.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"dependencies": {
44
"bootstrap": "4.3.1",
55
"jest": "26.6.0",
6+
"less": "4.x",
67
"node-sass": "4.x",
78
"normalize.css": "7.0.0",
89
"prop-types": "15.7.2",

packages/react-scripts/fixtures/kitchensink/template/integration/webpack.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ describe('Integration', () => {
8282
]);
8383
});
8484

85+
it('less inclusion', async () => {
86+
doc = await initDOM('less-inclusion');
87+
matchCSS(doc, [/#feature-less-inclusion\{background:.+;color:.+}/]);
88+
});
89+
90+
it('less modules inclusion', async () => {
91+
doc = await initDOM('less-modules-inclusion');
92+
matchCSS(doc, [
93+
/.+less-styles_lessModulesInclusion.+\{background:.+;color:.+}/,
94+
/.+assets_lessModulesIndexInclusion.+\{background:.+;color:.+}/,
95+
]);
96+
});
97+
8598
it('image inclusion', async () => {
8699
doc = await initDOM('image-inclusion');
87100

packages/react-scripts/fixtures/kitchensink/template/src/App.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ class App extends Component {
126126
this.setFeature(f.default)
127127
);
128128
break;
129+
case 'less-inclusion':
130+
import('./features/webpack/LessInclusion').then(f =>
131+
this.setFeature(f.default)
132+
);
133+
break;
134+
case 'less-modules-inclusion':
135+
import('./features/webpack/LessModulesInclusion').then(f =>
136+
this.setFeature(f.default)
137+
);
138+
break;
129139
case 'custom-interpolation':
130140
import('./features/syntax/CustomInterpolation').then(f =>
131141
this.setFeature(f.default)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import React from 'react';
9+
import './assets/less-styles.less';
10+
11+
const LessInclusion = () => (
12+
<p id="feature-less-inclusion">We love useless text.</p>
13+
);
14+
15+
export default LessInclusion;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import React from 'react';
9+
import ReactDOM from 'react-dom';
10+
import LessInclusion from './LessInclusion';
11+
12+
describe('less inclusion', () => {
13+
it('renders without crashing', () => {
14+
const div = document.createElement('div');
15+
ReactDOM.render(<LessInclusion />, div);
16+
});
17+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import React from 'react';
9+
import styles from './assets/less-styles.module.less';
10+
import indexStyles from './assets/index.module.less';
11+
12+
const LessModulesInclusion = () => (
13+
<div>
14+
<p className={styles.lessModulesInclusion}>LESS Modules are working!</p>
15+
<p className={indexStyles.lessModulesIndexInclusion}>
16+
LESS Modules with index are working!
17+
</p>
18+
</div>
19+
);
20+
21+
export default LessModulesInclusion;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import React from 'react';
9+
import ReactDOM from 'react-dom';
10+
import LessModulesInclusion from './LessModulesInclusion';
11+
12+
describe('less modules inclusion', () => {
13+
it('renders without crashing', () => {
14+
const div = document.createElement('div');
15+
ReactDOM.render(<LessModulesInclusion />, div);
16+
});
17+
});
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.lessModulesIndexInclusion {
2+
background: darkblue;
3+
color: lightblue;
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#feature-less-inclusion {
2+
background: ghostwhite;
3+
color: crimson;
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.lessModulesInclusion {
2+
background: darkblue;
3+
color: lightblue;
4+
}

0 commit comments

Comments
 (0)