mirror of
https://github.com/bobwen-dev/react-templates
synced 2025-04-12 00:56:39 +02:00
Test for --normalize-html-whitespace CLI option
This commit is contained in:
parent
6348e53306
commit
720db6c121
23
test/data/whitespace.rt
Normal file
23
test/data/whitespace.rt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
This is a
|
||||||
|
{this.props.name}
|
||||||
|
example
|
||||||
|
</div>
|
||||||
|
<div>   </div>
|
||||||
|
<pre>
|
||||||
|
This is a
|
||||||
|
{this.props.name}
|
||||||
|
example
|
||||||
|
</pre>
|
||||||
|
<textarea>
|
||||||
|
This is a
|
||||||
|
{this.props.name}
|
||||||
|
example
|
||||||
|
<textarea>
|
||||||
|
<div rt-pre>
|
||||||
|
This is a
|
||||||
|
{this.props.name}
|
||||||
|
example
|
||||||
|
</pre>
|
||||||
|
</div>
|
9
test/data/whitespace.rt.js
Normal file
9
test/data/whitespace.rt.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
define([
|
||||||
|
'react',
|
||||||
|
'lodash'
|
||||||
|
], function (React, _) {
|
||||||
|
'use strict';
|
||||||
|
return function () {
|
||||||
|
return React.createElement('div', {}, React.createElement('div', {}, ' This is a ', this.props.name, ' example '), React.createElement('div', {}, ' \xA0 '), React.createElement('pre', {}, '\n This is a \n ', this.props.name, ' \n example\n '), React.createElement('textarea', {}, '\n This is a \n ', this.props.name, ' \n example\n ', React.createElement('textarea', {}, React.createElement('div', {}, '\n This is a \n ', this.props.name, ' \n example\n \n'))));
|
||||||
|
};
|
||||||
|
});
|
@ -90,6 +90,12 @@ module.exports = {
|
|||||||
files.forEach(file => check(t, file));
|
files.forEach(file => check(t, file));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('normalize whitespace', t => {
|
||||||
|
const files = ['whitespace.rt'];
|
||||||
|
const options = {normalizeHtmlWhitespace: true, modules: 'amd'};
|
||||||
|
testFiles(t, files, options);
|
||||||
|
});
|
||||||
|
|
||||||
test('convert comment with AMD and ES6 modules', t => {
|
test('convert comment with AMD and ES6 modules', t => {
|
||||||
const files = [
|
const files = [
|
||||||
{source: 'comment.rt', expected: 'comment.rt.amd.js', options: {modules: 'amd'}},
|
{source: 'comment.rt', expected: 'comment.rt.amd.js', options: {modules: 'amd'}},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user