',
'partial inclusion completes'
);
- test.equals(
+ test.equal(
pattern.patternPartialCode.indexOf('test-foo.rendered.html') > -1,
true,
'data link should be replaced properly'
@@ -179,9 +179,9 @@ tap.test('buildPatterns suite', test => {
tap.test(
'finds partials with their own parameters and renders them too',
- function(test) {
+ function (test) {
var pattern = get('test-c', patternlab);
- test.equals(
+ test.equal(
util.sanitized(pattern.patternPartialCode),
util.sanitized(`cb
@@ -195,9 +195,9 @@ tap.test('buildPatterns suite', test => {
tap.test(
'finds and extends templates with mixed parameter and global data',
- function(test) {
+ function (test) {
var pattern = get('test-sticky-comment', patternlab);
- test.equals(
+ test.equal(
util.sanitized(pattern.patternPartialCode),
util.sanitized(
`
Bar
A life is like a garden. Perfect moments can be had, but not preserved, except in memory.
`
@@ -207,9 +207,9 @@ tap.test('buildPatterns suite', test => {
}
);
- tap.test('expands links inside parameters', function(test) {
+ tap.test('expands links inside parameters', function (test) {
var pattern = get('test-linkInParameter', patternlab);
- test.equals(
+ test.equal(
util.sanitized(pattern.patternPartialCode),
util.sanitized(
`Cool Dude`
@@ -218,10 +218,10 @@ tap.test('buildPatterns suite', test => {
test.end();
});
- tap.test('uses global listItem property', test => {
+ tap.test('uses global listItem property', (test) => {
var pattern = get('test-listWithPartial', patternlab);
let assertionCount = 0;
- ['dA', 'dB', 'dC'].forEach(d => {
+ ['dA', 'dB', 'dC'].forEach((d) => {
if (pattern.patternPartialCode.indexOf(d) > -1) {
assertionCount++;
}
@@ -232,7 +232,7 @@ tap.test('buildPatterns suite', test => {
tap.test(
'overwrites listItem property if that property is in local .listitem.json',
- test => {
+ (test) => {
var pattern = get('test-listWithListItems', patternlab);
test.ok(pattern.patternPartialCode.indexOf('tX') > -1);
test.ok(pattern.patternPartialCode.indexOf('tY') > -1);
@@ -244,7 +244,7 @@ tap.test('buildPatterns suite', test => {
tap.test(
'uses global listItem property after merging local .listitem.json',
- test => {
+ (test) => {
var pattern = get('test-listWithListItems', patternlab);
test.ok(pattern.patternPartialCode.indexOf('dA') > -1);
test.ok(pattern.patternPartialCode.indexOf('dB') > -1);
@@ -255,9 +255,9 @@ tap.test('buildPatterns suite', test => {
tap.test(
'correctly ignores bookended partials without a style modifier when the same partial has a style modifier between',
- test => {
+ (test) => {
var pattern = get('test-bookend-listitem', patternlab);
- test.equals(
+ test.equal(
util.sanitized(pattern.extendedTemplate),
util.sanitized(`
{{#listItems-two}}
@@ -283,9 +283,9 @@ tap.test('buildPatterns suite', test => {
tap.test(
'listItems keys (`one` through `twelve`) can be used more than once per pattern',
- test => {
+ (test) => {
var pattern = get('test-repeatedListItems', patternlab);
- test.equals(
+ test.equal(
util.sanitized(pattern.patternPartialCode),
util.sanitized(`AAA BBB`)
);
@@ -298,7 +298,7 @@ tap.test('buildPatterns suite', test => {
// From issue #145 https://github.com/pattern-lab/patternlab-node/issues/145
// tap.test(' parses parameters containing html tags', function (test) {
// var pattern = get('test-parameterTags', patternlab);
- // test.equals(util.sanitized(pattern.patternPartialCode), util.sanitized(`
';
- test.equals(
+ test.equal(
util.sanitized(groupPattern.extendedTemplate),
util.sanitized(expectedValue)
);
@@ -119,7 +119,7 @@ tap.only(
tap.test(
'processRecursive - correctly ignores a partial without a style modifier when the same partial later has a style modifier',
- function(test) {
+ function (test) {
//arrange
const patternlab = util.fakePatternLab(patterns_dir);
@@ -140,7 +140,7 @@ tap.test(
//assert. here we expect {{styleModifier}} to be in the first group, since it was not replaced by anything. rendering with data will then remove this (correctly)
const expectedValue =
'
{{message}} {{message}} {{message}} {{message}}
';
- test.equals(
+ test.equal(
util.sanitized(mixedPattern.extendedTemplate),
util.sanitized(expectedValue)
);
@@ -154,7 +154,7 @@ tap.test(
tap.test(
'processRecursive - correctly ignores bookended partials without a style modifier when the same partial has a style modifier between',
- function(test) {
+ function (test) {
//arrange
const patternlab = util.fakePatternLab(patterns_dir);
@@ -175,7 +175,7 @@ tap.test(
//assert. here we expect {{styleModifier}} to be in the first and last group, since it was not replaced by anything. rendering with data will then remove this (correctly)
const expectedValue =
'
{{message}} {{message}} {{message}} {{message}}
';
- test.equals(
+ test.equal(
util.sanitized(bookendPattern.extendedTemplate),
util.sanitized(expectedValue)
);
@@ -189,7 +189,7 @@ tap.test(
tap.test(
'processRecursive - correctly ignores a partial without a style modifier when the same partial later has a style modifier and pattern parameters',
- function(test) {
+ function (test) {
//arrange
const patternlab = util.fakePatternLab(patterns_dir);
@@ -210,7 +210,7 @@ tap.test(
//assert. here we expect {{styleModifier}} to be in the first span, since it was not replaced by anything. rendering with data will then remove this (correctly)
const expectedValue =
'
{{message}} 2 3 4
';
- test.equals(
+ test.equal(
util.sanitized(mixedPattern.extendedTemplate),
util.sanitized(expectedValue)
);
@@ -224,7 +224,7 @@ tap.test(
tap.test(
'processRecursive - correctly ignores bookended partials without a style modifier when the same partial has a style modifier and pattern parameters between',
- function(test) {
+ function (test) {
//arrange
const patternlab = util.fakePatternLab(patterns_dir);
@@ -245,7 +245,7 @@ tap.test(
//assert. here we expect {{styleModifier}} to be in the first and last span, since it was not replaced by anything. rendering with data will then remove this (correctly)
const expectedValue =
'
{{message}} 2 3 {{message}}
';
- test.equals(
+ test.equal(
util.sanitized(bookendPattern.extendedTemplate),
util.sanitized(expectedValue)
);
@@ -259,7 +259,7 @@ tap.test(
tap.test(
'processRecursive - does not pollute previous patterns when a later one is found with a styleModifier',
- function(test) {
+ function (test) {
//arrange
const patternlab = util.fakePatternLab(patterns_dir);
@@ -284,21 +284,21 @@ tap.test(
' {{message}} ';
//this is the "atom" - it should remain unchanged
- test.equals(
+ test.equal(
util.sanitized(atomPattern.template),
util.sanitized(expectedCleanValue)
);
- test.equals(
+ test.equal(
util.sanitized(atomPattern.extendedTemplate),
util.sanitized(expectedCleanValue)
);
// this is the style modifier pattern, which should resolve correctly
- test.equals(
+ test.equal(
util.sanitized(anotherPattern.template),
'{{> test-styled-atom:test_1 }}'
);
- test.equals(
+ test.equal(
util.sanitized(anotherPattern.extendedTemplate),
util.sanitized(expectedSetValue)
);
@@ -311,7 +311,7 @@ tap.test(
);
tap
- .test('processRecursive - ensure deep-nesting works', function(test) {
+ .test('processRecursive - ensure deep-nesting works', function (test) {
//arrange
const patternlab = util.fakePatternLab(patterns_dir);
@@ -339,31 +339,28 @@ tap
//act
return test.test(
'processRecursive - ensure deep-nesting works2',
- function(tt) {
+ function (tt) {
//assert
const expectedCleanValue = 'bar';
const expectedSetValue = 'bar';
//this is the "atom" - it should remain unchanged
- tt.equals(util.sanitized(atomPattern.template), expectedCleanValue);
- tt.equals(
+ tt.equal(util.sanitized(atomPattern.template), expectedCleanValue);
+ tt.equal(
util.sanitized(atomPattern.extendedTemplate),
expectedCleanValue
);
//this is the "template pattern" - it should have an updated extendedTemplate but an unchanged template
- tt.equals(
- util.sanitized(templatePattern.template),
- '{{> test-bar }}'
- );
- tt.equals(
+ tt.equal(util.sanitized(templatePattern.template), '{{> test-bar }}');
+ tt.equal(
util.sanitized(templatePattern.extendedTemplate),
expectedSetValue
);
//this is the "pages pattern" - it should have an updated extendedTemplate equal to the template pattern but an unchanged template
- tt.equals(util.sanitized(pagesPattern.template), '{{> test-foo }}');
- tt.equals(
+ tt.equal(util.sanitized(pagesPattern.template), '{{> test-foo }}');
+ tt.equal(
util.sanitized(pagesPattern.extendedTemplate),
expectedSetValue
);
@@ -375,7 +372,7 @@ tap
})
.catch(tap.threw);
-tap.test('hidden patterns can be called by their nice names', function(test) {
+tap.test('hidden patterns can be called by their nice names', function (test) {
//arrange
const patternlab = util.fakePatternLab(patterns_dir);
@@ -393,9 +390,9 @@ tap.test('hidden patterns can be called by their nice names', function(test) {
//act
processRecursive(hiddenPatternPath, patternlab).then(() => {
processRecursive(testPatternPath, patternlab).then(() => {
- testPattern.render().then(results => {
+ testPattern.render().then((results) => {
//assert
- test.equals(
+ test.equal(
util.sanitized(results),
util.sanitized(
"Hello there! Here's the hidden atom: [This is the hidden atom]"
@@ -409,35 +406,36 @@ tap.test('hidden patterns can be called by their nice names', function(test) {
});
});
-tap.test('parses pattern title correctly when frontmatter present', function(
- test
-) {
- //arrange
- var pl = util.fakePatternLab(patterns_dir);
+tap.test(
+ 'parses pattern title correctly when frontmatter present',
+ function (test) {
+ //arrange
+ var pl = util.fakePatternLab(patterns_dir);
- var testPatternPath = path.join('test', 'bar.mustache');
- var testPattern = loadPattern(testPatternPath, pl);
+ var testPatternPath = path.join('test', 'bar.mustache');
+ var testPattern = loadPattern(testPatternPath, pl);
- //act
- Promise.all([
- processIterative(testPattern, pl),
- processRecursive(testPatternPath, pl),
- ])
- .then(results => {
- //assert
- test.equals(
- results[0].patternName,
- 'An Atom Walks Into a Bar',
- 'patternName not overridden'
- );
- test.end();
- })
- .catch(test.threw);
-});
+ //act
+ Promise.all([
+ processIterative(testPattern, pl),
+ processRecursive(testPatternPath, pl),
+ ])
+ .then((results) => {
+ //assert
+ test.equal(
+ results[0].patternName,
+ 'An Atom Walks Into a Bar',
+ 'patternName not overridden'
+ );
+ test.end();
+ })
+ .catch(test.threw);
+ }
+);
tap.test(
'parses pattern extra frontmatter correctly when frontmatter present',
- function(test) {
+ function (test) {
//arrange
var pl = util.fakePatternLab(patterns_dir);
@@ -449,9 +447,9 @@ tap.test(
processIterative(testPattern, pl),
processRecursive(testPatternPath, pl),
])
- .then(results => {
+ .then((results) => {
//assert
- test.equals(results[0].allMarkdown.joke, 'bad', 'extra key not added');
+ test.equal(results[0].allMarkdown.joke, 'bad', 'extra key not added');
test.end();
})
.catch(test.threw);
diff --git a/packages/core/test/pseudopattern_hunter_tests.js b/packages/core/test/pseudopattern_hunter_tests.js
index c1372db4f..f37b60363 100644
--- a/packages/core/test/pseudopattern_hunter_tests.js
+++ b/packages/core/test/pseudopattern_hunter_tests.js
@@ -42,7 +42,7 @@ function stubPatternlab() {
return pl;
}
-tap.test('pseudpattern found and added as a pattern', function(test) {
+tap.test('pseudpattern found and added as a pattern', function (test) {
//arrange
var pl = stubPatternlab();
@@ -53,20 +53,20 @@ tap.test('pseudpattern found and added as a pattern', function(test) {
var patternCountBefore = pl.patterns.length;
return pph.find_pseudopatterns(atomPattern, pl).then(() => {
//assert
- test.equals(patternCountBefore + 1, pl.patterns.length);
- test.equals(pl.patterns[1].patternPartial, 'test-styled-atom-alt');
- test.equals(
+ test.equal(patternCountBefore + 1, pl.patterns.length);
+ test.equal(pl.patterns[1].patternPartial, 'test-styled-atom-alt');
+ test.equal(
JSON.stringify(pl.patterns[1].jsonFileData),
JSON.stringify({ message: 'alternateMessage' })
);
- test.equals(
+ test.equal(
pl.patterns[1].patternLink,
'test-styled-atom-alt' + path.sep + 'test-styled-atom-alt.html'
);
});
});
-tap.test('pseudpattern does not pollute base pattern data', function(test) {
+tap.test('pseudpattern does not pollute base pattern data', function (test) {
//arrange
var pl = stubPatternlab();
@@ -76,8 +76,8 @@ tap.test('pseudpattern does not pollute base pattern data', function(test) {
var patternCountBefore = pl.patterns.length;
return pph.find_pseudopatterns(atomPattern, pl).then(() => {
//assert
- test.equals(pl.patterns[0].patternPartial, 'test-styled-atom');
- test.equals(
+ test.equal(pl.patterns[0].patternPartial, 'test-styled-atom');
+ test.equal(
JSON.stringify(pl.patterns[0].jsonFileData),
JSON.stringify({ message: 'baseMessage' })
);
@@ -86,7 +86,7 @@ tap.test('pseudpattern does not pollute base pattern data', function(test) {
tap.test(
'pseudpattern variant includes stylePartials and parameteredPartials',
- function(test) {
+ function (test) {
//arrange
var pl = stubPatternlab();
@@ -122,9 +122,9 @@ tap.test(
//act
return pph.find_pseudopatterns(pseudoPattern, pl).then(() => {
//assert
- test.equals(pl.patterns[2].patternPartial, 'test-pseudomodifier-test');
- test.equals(pl.patterns[2].stylePartials, pseudoPattern.stylePartials);
- test.equals(
+ test.equal(pl.patterns[2].patternPartial, 'test-pseudomodifier-test');
+ test.equal(pl.patterns[2].stylePartials, pseudoPattern.stylePartials);
+ test.equal(
pl.patterns[2].parameteredPartials,
pseudoPattern.parameteredPartials
);
@@ -132,7 +132,7 @@ tap.test(
}
);
-tap.test('pseudo pattern variant data should merge arrays', function(test) {
+tap.test('pseudo pattern variant data should merge arrays', function (test) {
const pl = stubPatternlab();
pl.config.patternMergeVariantArrays = true;
@@ -141,8 +141,8 @@ tap.test('pseudo pattern variant data should merge arrays', function(test) {
addPattern(pattern, pl);
return pph.find_pseudopatterns(pattern, pl).then(() => {
- test.equals(pl.patterns[1].patternPartial, 'test-variant-test-merge');
- test.equals(
+ test.equal(pl.patterns[1].patternPartial, 'test-variant-test-merge');
+ test.equal(
JSON.stringify(pl.patterns[1].jsonFileData),
JSON.stringify({
a: 2,
@@ -155,7 +155,7 @@ tap.test('pseudo pattern variant data should merge arrays', function(test) {
tap.test(
'pseudo pattern variant data should merge arrays if config "patternMergeVariantArrays" is not available as default behavior',
- function(test) {
+ function (test) {
const pl = stubPatternlab();
const pattern = loadPattern('test/variant-test.mustache', pl);
@@ -163,8 +163,8 @@ tap.test(
addPattern(pattern, pl);
return pph.find_pseudopatterns(pattern, pl).then(() => {
- test.equals(pl.patterns[1].patternPartial, 'test-variant-test-merge');
- test.equals(
+ test.equal(pl.patterns[1].patternPartial, 'test-variant-test-merge');
+ test.equal(
JSON.stringify(pl.patterns[1].jsonFileData),
JSON.stringify({
a: 2,
@@ -176,7 +176,7 @@ tap.test(
}
);
-tap.test('pseudo pattern variant data should override arrays', function(test) {
+tap.test('pseudo pattern variant data should override arrays', function (test) {
const pl = stubPatternlab();
pl.config.patternMergeVariantArrays = false;
@@ -185,8 +185,8 @@ tap.test('pseudo pattern variant data should override arrays', function(test) {
addPattern(pattern, pl);
return pph.find_pseudopatterns(pattern, pl).then(() => {
- test.equals(pl.patterns[1].patternPartial, 'test-variant-test-merge');
- test.equals(
+ test.equal(pl.patterns[1].patternPartial, 'test-variant-test-merge');
+ test.equal(
JSON.stringify(pl.patterns[1].jsonFileData),
JSON.stringify({
a: 2,
diff --git a/packages/core/test/replaceParameter_tests.js b/packages/core/test/replaceParameter_tests.js
index 41fde31c1..c3dfc129f 100644
--- a/packages/core/test/replaceParameter_tests.js
+++ b/packages/core/test/replaceParameter_tests.js
@@ -6,44 +6,44 @@ const tap = require('tap');
const replaceParameter = require('../src/lib/replaceParameter');
-tap.test('replaces simple value', function(test) {
+tap.test('replaces simple value', function (test) {
const result = replaceParameter('{{key}}', 'key', 'value');
- test.equals(result, 'value');
+ test.equal(result, 'value');
test.end();
});
-tap.test('replaces simple boolean true value', function(test) {
+tap.test('replaces simple boolean true value', function (test) {
const result = replaceParameter('{{key}}', 'key', true);
- test.equals(result, 'true');
+ test.equal(result, 'true');
test.end();
});
-tap.test('replaces simple boolean false value', function(test) {
+tap.test('replaces simple boolean false value', function (test) {
const result = replaceParameter('{{key}}', 'key', false);
- test.equals(result, 'false');
+ test.equal(result, 'false');
test.end();
});
-tap.test('replaces raw value', function(test) {
+tap.test('replaces raw value', function (test) {
const result = replaceParameter('{{{key}}}', 'key', 'value');
- test.equals(result, 'value');
+ test.equal(result, 'value');
test.end();
});
-tap.test('replaces boolean true section', function(test) {
+tap.test('replaces boolean true section', function (test) {
const result = replaceParameter('1{{#key}}value{{/key}}2', 'key', true);
- test.equals(result, '1value2');
+ test.equal(result, '1value2');
test.end();
});
-tap.only('replaces boolean true section with spaces', function(test) {
+tap.only('replaces boolean true section with spaces', function (test) {
const result = replaceParameter('1{{ #key }}value{{ /key }}2', 'key', true);
- test.equals(result, '1value2');
+ test.equal(result, '1value2');
test.end();
});
-tap.test('replaces boolean section false', function(test) {
+tap.test('replaces boolean section false', function (test) {
const result = replaceParameter('1{{#key}}value{{/key}}2', 'key', false);
- test.equals(result, '12');
+ test.equal(result, '12');
test.end();
});
diff --git a/packages/core/test/style_modifier_hunter_tests.js b/packages/core/test/style_modifier_hunter_tests.js
index bdbc1e994..93c76f92e 100644
--- a/packages/core/test/style_modifier_hunter_tests.js
+++ b/packages/core/test/style_modifier_hunter_tests.js
@@ -6,7 +6,7 @@ var smh = require('../src/lib/style_modifier_hunter');
tap.test(
'uses the partial stylemodifer to modify the patterns extendedTemplate',
- function(test) {
+ function (test) {
//arrange
var pl = {};
pl.partials = {};
@@ -27,12 +27,12 @@ tap.test(
);
//assert
- test.equals(pattern.extendedTemplate, '');
+ test.equal(pattern.extendedTemplate, '');
test.end();
}
);
-tap.test('replaces style modifiers with spaces in the syntax', function(test) {
+tap.test('replaces style modifiers with spaces in the syntax', function (test) {
//arrange
var pl = {};
pl.partials = {};
@@ -53,11 +53,11 @@ tap.test('replaces style modifiers with spaces in the syntax', function(test) {
);
//assert
- test.equals(pattern.extendedTemplate, '');
+ test.equal(pattern.extendedTemplate, '');
test.end();
});
-tap.test('replaces multiple style modifiers', function(test) {
+tap.test('replaces multiple style modifiers', function (test) {
//arrange
var pl = {};
pl.partials = {};
@@ -78,13 +78,13 @@ tap.test('replaces multiple style modifiers', function(test) {
);
//assert
- test.equals(pattern.extendedTemplate, '');
+ test.equal(pattern.extendedTemplate, '');
test.end();
});
tap.test(
'does not alter pattern extendedTemplate if styleModifier not found in partial',
- function(test) {
+ function (test) {
//arrange
var pl = {};
pl.partials = {};
@@ -101,7 +101,7 @@ tap.test(
style_modifier_hunter.consume_style_modifier(pattern, '{{> partial}}', pl);
//assert
- test.equals(
+ test.equal(
pattern.extendedTemplate,
''
);
diff --git a/packages/core/test/ui_builder_tests.js b/packages/core/test/ui_builder_tests.js
index f5e63f4e8..010bba9d4 100644
--- a/packages/core/test/ui_builder_tests.js
+++ b/packages/core/test/ui_builder_tests.js
@@ -15,14 +15,14 @@ engineLoader.loadAllEngines(config);
//set up a global mocks - we don't want to be writing/rendering any files right now
var fsMock = {
- outputFileSync: function(path, data, cb) {},
- outputFile: function(path, data, cb) {},
+ outputFileSync: function (path, data, cb) {},
+ outputFile: function (path, data, cb) {},
};
-var renderMock = function(template, data, partials) {
+var renderMock = function (template, data, partials) {
return Promise.resolve('');
};
-var buildFooterMock = function(patternlab, patternPartial) {
+var buildFooterMock = function (patternlab, patternPartial) {
return Promise.resolve('');
};
@@ -69,7 +69,7 @@ function createFakePatternLab(customProps) {
tap.test(
'isPatternExcluded - returns true when pattern filename starts with underscore',
- function(test) {
+ function (test) {
//arrange
var patternlab = createFakePatternLab({});
var pattern = new Pattern('test/ignored-pattern.mustache');
@@ -79,14 +79,14 @@ tap.test(
var result = ui.isPatternExcluded(pattern, patternlab, uikit);
//assert
- test.equals(result, true);
+ test.equal(result, true);
test.end();
}
);
tap.test(
'isPatternExcluded - returns true when pattern is defaultPattern',
- function(test) {
+ function (test) {
//arrange
var patternlab = createFakePatternLab({});
var pattern = new Pattern('test/foo.mustache');
@@ -96,14 +96,14 @@ tap.test(
var result = ui.isPatternExcluded(pattern, patternlab, uikit);
//assert
- test.equals(result, true);
+ test.equal(result, true);
test.end();
}
);
tap.test(
'isPatternExcluded - returns true when pattern within underscored directory - top level',
- function(test) {
+ function (test) {
//arrange
var patternlab = createFakePatternLab({});
var pattern = Pattern.createEmpty({
@@ -127,14 +127,14 @@ tap.test(
var result = ui.isPatternExcluded(pattern, patternlab, uikit);
//assert
- test.equals(result, true);
+ test.equal(result, true);
test.end();
}
);
tap.test(
'isPatternExcluded - returns true when pattern within underscored directory - subgroup level',
- function(test) {
+ function (test) {
//arrange
var patternlab = createFakePatternLab({});
var pattern = Pattern.createEmpty({
@@ -153,14 +153,14 @@ tap.test(
var result = ui.isPatternExcluded(pattern, patternlab, uikit);
//assert
- test.equals(result, true);
+ test.equal(result, true);
test.end();
}
);
tap.test(
'isPatternExcluded - returns true when pattern state found withing uikit exclusions',
- function(test) {
+ function (test) {
//arrange
var patternlab = createFakePatternLab({});
var pattern = Pattern.createEmpty({
@@ -178,12 +178,12 @@ tap.test(
});
//assert
- test.equals(result, true);
+ test.equal(result, true);
test.end();
}
);
-tap.test('groupPatterns - creates pattern groups correctly', function(test) {
+tap.test('groupPatterns - creates pattern groups correctly', function (test) {
//arrange
var patternlab = createFakePatternLab({
patterns: [],
@@ -207,27 +207,27 @@ tap.test('groupPatterns - creates pattern groups correctly', function(test) {
//act
var result = ui.groupPatterns(patternlab, uikit);
- test.equals(
+ test.equal(
result.patternGroups.patternGroup1.patternSubgroup1.blue.patternPartial,
'patternGroup1-blue'
);
- test.equals(
+ test.equal(
result.patternGroups.patternGroup1.patternSubgroup1.red.patternPartial,
'patternGroup1-red'
);
- test.equals(
+ test.equal(
result.patternGroups.patternGroup1.patternSubgroup1.yellow.patternPartial,
'patternGroup1-yellow'
);
- test.equals(
+ test.equal(
result.patternGroups.patternGroup1.patternSubgroup2.black.patternPartial,
'patternGroup1-black'
);
- test.equals(
+ test.equal(
result.patternGroups.patternGroup1.patternSubgroup2.grey.patternPartial,
'patternGroup1-grey'
);
- test.equals(
+ test.equal(
result.patternGroups.patternGroup1.patternSubgroup2.white.patternPartial,
'patternGroup1-white'
);
@@ -241,17 +241,17 @@ tap.test('groupPatterns - creates pattern groups correctly', function(test) {
//"patternGroup1", "root" (because it's a top-level flat pattern) and at last "test"
// Flat patterns
- test.equals(
+ test.equal(
patternlab.patternGroups[1].patternItems[0].patternPartial,
'root-foobar',
'flat pattern foobar on root'
);
- test.equals(
+ test.equal(
patternlab.patternGroups[2].patternItems[0].patternPartial,
'test-bar',
'first pattern item should be test-bar'
);
- test.equals(
+ test.equal(
patternlab.patternGroups[2].patternItems[1].patternPartial,
'test-foo',
'second pattern item should be test-foo'
@@ -262,51 +262,52 @@ tap.test('groupPatterns - creates pattern groups correctly', function(test) {
test.end();
});
-tap.test('groupPatterns - orders patterns when provided from md', function(
- test
-) {
- //arrange
- var patternlab = createFakePatternLab({
- patterns: [],
- patternGroups: {},
- subgroupPatterns: {},
- });
+tap.test(
+ 'groupPatterns - orders patterns when provided from md',
+ function (test) {
+ //arrange
+ var patternlab = createFakePatternLab({
+ patterns: [],
+ patternGroups: {},
+ subgroupPatterns: {},
+ });
- // Should be sorted by order and secondly by name
- patternlab.patterns.push(
- new Pattern('patternGroup1/patternSubgroup1/yellow.mustache'),
- new Pattern('patternGroup1/patternSubgroup1/red.mustache'),
- new Pattern('patternGroup1/patternSubgroup1/blue.mustache')
- );
- ui.resetUIBuilderState(patternlab);
+ // Should be sorted by order and secondly by name
+ patternlab.patterns.push(
+ new Pattern('patternGroup1/patternSubgroup1/yellow.mustache'),
+ new Pattern('patternGroup1/patternSubgroup1/red.mustache'),
+ new Pattern('patternGroup1/patternSubgroup1/blue.mustache')
+ );
+ ui.resetUIBuilderState(patternlab);
- // Set order of red to 1 to sort it after the others
- patternlab.patterns[1].order = 1;
+ // Set order of red to 1 to sort it after the others
+ patternlab.patterns[1].order = 1;
- //act
- ui.groupPatterns(patternlab, uikit);
-
- let patternGroup = _.find(patternlab.patternGroups, [
- 'patternGroup',
- 'patternGroup1',
- ]);
- let patternSubgroup = _.find(patternGroup.patternGroupItems, [
- 'patternSubgroup',
- 'patternSubgroup1',
- ]);
- var items = patternSubgroup.patternSubgroupItems;
-
- // Viewall should come last since it shows all patterns that are above
- test.equals(items[0].patternPartial, 'patternGroup1-blue');
- test.equals(items[1].patternPartial, 'patternGroup1-yellow');
- test.equals(items[2].patternPartial, 'patternGroup1-red');
+ //act
+ ui.groupPatterns(patternlab, uikit);
- test.end();
-});
+ let patternGroup = _.find(patternlab.patternGroups, [
+ 'patternGroup',
+ 'patternGroup1',
+ ]);
+ let patternSubgroup = _.find(patternGroup.patternGroupItems, [
+ 'patternSubgroup',
+ 'patternSubgroup1',
+ ]);
+ var items = patternSubgroup.patternSubgroupItems;
+
+ // Viewall should come last since it shows all patterns that are above
+ test.equal(items[0].patternPartial, 'patternGroup1-blue');
+ test.equal(items[1].patternPartial, 'patternGroup1-yellow');
+ test.equal(items[2].patternPartial, 'patternGroup1-red');
+
+ test.end();
+ }
+);
tap.test(
'groupPatterns - retains pattern order from name when order provided from md is malformed',
- function(test) {
+ function (test) {
//arrange
var patternlab = createFakePatternLab({
patterns: [],
@@ -337,9 +338,9 @@ tap.test(
var items = patternSubgroup.patternSubgroupItems;
// Viewall should come last since it shows all patterns that are above
- test.equals(items[0].patternPartial, 'patternGroup1-blue');
- test.equals(items[1].patternPartial, 'patternGroup1-red');
- test.equals(items[2].patternPartial, 'patternGroup1-yellow');
+ test.equal(items[0].patternPartial, 'patternGroup1-blue');
+ test.equal(items[1].patternPartial, 'patternGroup1-red');
+ test.equal(items[2].patternPartial, 'patternGroup1-yellow');
test.end();
}
@@ -347,7 +348,7 @@ tap.test(
tap.test(
'groupPatterns - sorts viewall subgroup pattern to the beginning',
- function(test) {
+ function (test) {
//arrange
var patternlab = createFakePatternLab({
patterns: [],
@@ -380,13 +381,13 @@ tap.test(
var items = patternSubgroup.patternSubgroupItems;
// Viewall should come last since it shows all patterns that are above
- test.equals(
+ test.equal(
items[3].patternPartial,
'viewall-patternGroup1-patternSubgroup1'
);
- test.equals(items[0].patternPartial, 'patternGroup1-blue');
- test.equals(items[1].patternPartial, 'patternGroup1-yellow');
- test.equals(items[2].patternPartial, 'patternGroup1-red');
+ test.equal(items[0].patternPartial, 'patternGroup1-blue');
+ test.equal(items[1].patternPartial, 'patternGroup1-yellow');
+ test.equal(items[2].patternPartial, 'patternGroup1-red');
test.end();
}
@@ -394,7 +395,7 @@ tap.test(
tap.test(
'groupPatterns - creates documentation patterns for each type and subgroup if not exists',
- function(test) {
+ function (test) {
//arrange
var patternlab = createFakePatternLab({
patterns: [],
@@ -418,13 +419,13 @@ tap.test(
var result = ui.groupPatterns(patternlab, uikit);
//assert
- test.equals(
+ test.equal(
result.patternGroups.patternGroup1.patternSubgroup1[
'viewall-patternGroup1-patternSubgroup1'
].patternPartial,
'viewall-patternGroup1-patternSubgroup1'
);
- test.equals(
+ test.equal(
result.patternGroups.patternGroup1.patternSubgroup2[
'viewall-patternGroup1-patternSubgroup2'
].patternPartial,
@@ -437,7 +438,7 @@ tap.test(
tap.test(
'groupPatterns - adds each pattern to the patternPaths object',
- function(test) {
+ function (test) {
//arrange
var patternlab = createFakePatternLab({
patterns: [],
@@ -461,29 +462,29 @@ tap.test(
var result = ui.groupPatterns(patternlab, uikit);
//assert
- test.equals(patternlab.patternPaths['test']['foo'], 'test-foo');
- test.equals(patternlab.patternPaths['test']['bar'], 'test-bar');
- test.equals(
+ test.equal(patternlab.patternPaths['test']['foo'], 'test-foo');
+ test.equal(patternlab.patternPaths['test']['bar'], 'test-bar');
+ test.equal(
patternlab.patternPaths['patternGroup1']['blue'],
'patternGroup1-patternSubgroup1-blue'
);
- test.equals(
+ test.equal(
patternlab.patternPaths['patternGroup1']['red'],
'patternGroup1-patternSubgroup1-red'
);
- test.equals(
+ test.equal(
patternlab.patternPaths['patternGroup1']['yellow'],
'patternGroup1-patternSubgroup1-yellow'
);
- test.equals(
+ test.equal(
patternlab.patternPaths['patternGroup1']['black'],
'patternGroup1-patternSubgroup2-black'
);
- test.equals(
+ test.equal(
patternlab.patternPaths['patternGroup1']['grey'],
'patternGroup1-patternSubgroup2-grey'
);
- test.equals(
+ test.equal(
patternlab.patternPaths['patternGroup1']['white'],
'patternGroup1-patternSubgroup2-white'
);
@@ -494,7 +495,7 @@ tap.test(
tap.test(
'groupPatterns - adds each pattern to the view all paths object',
- function(test) {
+ function (test) {
//arrange
var patternlab = createFakePatternLab({
patterns: [],
@@ -518,13 +519,13 @@ tap.test(
var result = ui.groupPatterns(patternlab, uikit);
//assert
- test.equals('todo', 'todo');
+ test.equal('todo', 'todo');
test.end();
}
);
-tap.test('resetUIBuilderState - reset global objects', function(test) {
+tap.test('resetUIBuilderState - reset global objects', function (test) {
//arrange
var patternlab = createFakePatternLab({
patternPaths: { foo: 1 },
@@ -536,16 +537,16 @@ tap.test('resetUIBuilderState - reset global objects', function(test) {
ui.resetUIBuilderState(patternlab);
//assert
- test.equals(patternlab.patternPaths.foo, undefined);
- test.equals(patternlab.viewAllPaths.bar, undefined);
- test.equals(patternlab.patternGroups.length, 0);
+ test.equal(patternlab.patternPaths.foo, undefined);
+ test.equal(patternlab.viewAllPaths.bar, undefined);
+ test.equal(patternlab.patternGroups.length, 0);
test.end();
});
tap.test(
'buildViewAllPages - adds viewall page for each type and subgroup NOT! for flat patterns',
- function(test) {
+ function (test) {
//arrange
const mainPageHeadHtml = '';
const patternlab = createFakePatternLab({
@@ -577,7 +578,7 @@ tap.test(
patternlab,
styleguidePatterns,
uikit
- ).then(allPatterns => {
+ ).then((allPatterns) => {
// assert
// this was a nuanced one. buildViewAllPages() had return false; statements
// within _.forOwn(...) loops, causing premature termination of the entire loop
@@ -604,7 +605,7 @@ tap.test(
* --- grey
* --- white
*/
- test.equals(uniquePatterns.length, 9, '3 viewall pages should be added');
+ test.equal(uniquePatterns.length, 9, '3 viewall pages should be added');
test.end();
});
@@ -613,7 +614,7 @@ tap.test(
tap.test(
'buildViewAllPages - adds viewall page for each type and subgroup FOR! flat patterns',
- function(test) {
+ function (test) {
//arrange
const mainPageHeadHtml = '';
const patternlab = createFakePatternLab({
@@ -647,7 +648,7 @@ tap.test(
patternlab,
styleguidePatterns,
uikit
- ).then(allPatterns => {
+ ).then((allPatterns) => {
// assert
// this was a nuanced one. buildViewAllPages() had return false; statements
// within _.forOwn(...) loops, causing premature termination of the entire loop
@@ -677,7 +678,7 @@ tap.test(
* --- grey
* --- white
*/
- test.equals(uniquePatterns.length, 11, '4 viewall pages should be added');
+ test.equal(uniquePatterns.length, 11, '4 viewall pages should be added');
test.end();
});
diff --git a/packages/core/test/uikitExcludePattern_tests.js b/packages/core/test/uikitExcludePattern_tests.js
index fbde9d5e8..f19301d12 100644
--- a/packages/core/test/uikitExcludePattern_tests.js
+++ b/packages/core/test/uikitExcludePattern_tests.js
@@ -6,7 +6,7 @@ const uikitExcludePattern = require('../src/lib/uikitExcludePattern');
tap.test(
'uikitExcludePattern - returns false when uikit has no excluded states',
- test => {
+ (test) => {
//arrange
const uikit = { excludedPatternStates: [] };
const pattern = { patternState: 'complete' };
@@ -22,7 +22,7 @@ tap.test(
tap.test(
'uikitExcludePattern - returns false pattern does not have same state as uikit exclusions',
- test => {
+ (test) => {
//arrange
const uikit = { excludedPatternStates: ['complete'] };
const pattern = { patternState: 'inprogress' };
@@ -38,7 +38,7 @@ tap.test(
tap.test(
'uikitExcludePattern - returns true when uikit has same state as pattern',
- test => {
+ (test) => {
//arrange
const uikit = { excludedPatternStates: ['inreview', 'complete'] };
const pattern = { patternState: 'complete' };
@@ -54,7 +54,7 @@ tap.test(
tap.test(
'uikitExcludePattern - returns false when uikit has no excluded tags',
- test => {
+ (test) => {
//arrange
const uikit = { excludedTags: [] };
const pattern = { tags: 'foo-tag' };
@@ -70,7 +70,7 @@ tap.test(
tap.test(
'uikitExcludePattern - returns false pattern does not have same tags as uikit exclusions',
- test => {
+ (test) => {
//arrange
const uikit = { excludedTags: ['bat-tag'] };
const pattern = { tags: 'foo-tag' };
@@ -86,7 +86,7 @@ tap.test(
tap.test(
'uikitExcludePattern - returns true when uikit has same tags as pattern',
- test => {
+ (test) => {
//arrange
const uikit = { excludedTags: ['bar-tag', 'foo-tag'] };
const pattern = { tags: 'foo-tag' };
diff --git a/packages/core/test/util/test_utils.js b/packages/core/test/util/test_utils.js
index e76a9506b..0558f500a 100644
--- a/packages/core/test/util/test_utils.js
+++ b/packages/core/test/util/test_utils.js
@@ -33,7 +33,7 @@ module.exports = {
* Strip out control characters from output if needed so make comparisons easier
* @param output - the template to strip
*/
- sanitized: outputTemplate => {
+ sanitized: (outputTemplate) => {
return outputTemplate
.replace(/\n/g, ' ')
.replace(/\r/g, ' ')
@@ -45,7 +45,7 @@ module.exports = {
* normalize a string (probably a path) to posix - style
* @param s - the string or array of strings to normalize path separators to posix - style
*/
- posixPath: s => {
+ posixPath: (s) => {
if (Array.isArray(s)) {
var paths = [];
for (let i = 0; i < s.length; i++) {
diff --git a/packages/core/test/watchAssets_tests.js b/packages/core/test/watchAssets_tests.js
index d72cd0715..ab96f3b0b 100644
--- a/packages/core/test/watchAssets_tests.js
+++ b/packages/core/test/watchAssets_tests.js
@@ -12,7 +12,7 @@ const patterns_dir = './test/files/_patterns';
tap.test(
'watchAssets - adds assetWatcher to patternlab.watchers for given key ',
- test => {
+ (test) => {
const pl = util.fakePatternLab(patterns_dir, { watchers: [] });
const key = 'images';
@@ -25,15 +25,15 @@ tap.test(
true
);
- test.equals(_.keys(pl.watchers)[0], 'images');
+ test.equal(_.keys(pl.watchers)[0], 'images');
test.end();
}
);
-tap.test('watchAssets - complete path copied', test => {
- const copyFileMock = function(p, des) {
- test.equals(des, path.resolve('/proj/public/images/sample/waterfall.jpg'));
+tap.test('watchAssets - complete path copied', (test) => {
+ const copyFileMock = function (p, des) {
+ test.equal(des, path.resolve('/proj/public/images/sample/waterfall.jpg'));
};
//set our mocks in place of usual require()
diff --git a/packages/core/test/watchPatternLabFiles_tests.js b/packages/core/test/watchPatternLabFiles_tests.js
index f61b873e6..0dcc7fbc1 100644
--- a/packages/core/test/watchPatternLabFiles_tests.js
+++ b/packages/core/test/watchPatternLabFiles_tests.js
@@ -12,7 +12,7 @@ const patterns_dir = './test/files/_patterns';
tap.test(
'watchPatternLabFiles - adds watcher to patternlab.watchers for given patternWatchPath',
- test => {
+ (test) => {
const pl = util.fakePatternLab(patterns_dir, {
watchers: [],
engines: {},
@@ -37,7 +37,7 @@ tap.test(
// should have two for _data and _meta
// should have five for '.json', '.yml', '.yaml', '.md' and '.mustache'
- test.equals(Object.keys(pl.watchers).length, 7);
+ test.equal(Object.keys(pl.watchers).length, 7);
test.end();
}
diff --git a/packages/development-edition-engine-handlebars/helpers/test.js b/packages/development-edition-engine-handlebars/helpers/test.js
index 8b32ed799..6ddbc2bba 100644
--- a/packages/development-edition-engine-handlebars/helpers/test.js
+++ b/packages/development-edition-engine-handlebars/helpers/test.js
@@ -1,5 +1,5 @@
-module.exports = function(Handlebars) {
- Handlebars.registerHelper('test', function() {
+module.exports = function (Handlebars) {
+ Handlebars.registerHelper('test', function () {
return 'This is a test helper';
});
};
diff --git a/packages/development-edition-engine-react/gulpfile.js b/packages/development-edition-engine-react/gulpfile.js
index 152cb5fd7..3f3658f89 100644
--- a/packages/development-edition-engine-react/gulpfile.js
+++ b/packages/development-edition-engine-react/gulpfile.js
@@ -33,33 +33,33 @@ function serve() {
});
}
-gulp.task('patternlab:version', function() {
+gulp.task('patternlab:version', function () {
patternlab.version();
});
-gulp.task('patternlab:help', function() {
+gulp.task('patternlab:help', function () {
patternlab.help();
});
-gulp.task('patternlab:patternsonly', function() {
+gulp.task('patternlab:patternsonly', function () {
patternlab.patternsonly(config.cleanPublic);
});
-gulp.task('patternlab:liststarterkits', function() {
+gulp.task('patternlab:liststarterkits', function () {
patternlab.liststarterkits();
});
-gulp.task('patternlab:loadstarterkit', function() {
+gulp.task('patternlab:loadstarterkit', function () {
patternlab.loadstarterkit(argv.kit, argv.clean);
});
-gulp.task('patternlab:build', function() {
+gulp.task('patternlab:build', function () {
build().then(() => {
// do something else when this promise resolves
});
});
-gulp.task('patternlab:serve', function() {
+gulp.task('patternlab:serve', function () {
serve().then(() => {
// do something else when this promise resolves
});
diff --git a/packages/development-edition-engine-react/source/_meta/_head.html b/packages/development-edition-engine-react/source/_meta/_head.html
index b1f5c1ce0..56d9a2432 100644
--- a/packages/development-edition-engine-react/source/_meta/_head.html
+++ b/packages/development-edition-engine-react/source/_meta/_head.html
@@ -2,15 +2,22 @@
{{ title }}
-
+
-
-
+
+
{{{ patternLabHead }}}
-
diff --git a/packages/docs/.eleventy.js b/packages/docs/.eleventy.js
index 9e8b8feaa..876122731 100644
--- a/packages/docs/.eleventy.js
+++ b/packages/docs/.eleventy.js
@@ -15,7 +15,7 @@ const parseTransform = require('./src/transforms/parse-transform.js');
// Import data files
const site = require('./src/_data/site.json');
-module.exports = function(config) {
+module.exports = function (config) {
// Filters
config.addFilter('dateFilter', dateFilter);
config.addFilter('markdownFilter', markdownFilter);
@@ -38,28 +38,28 @@ module.exports = function(config) {
const now = new Date();
// Custom collections
- const livePosts = post => post.date <= now && !post.data.draft;
- config.addCollection('posts', collection => {
+ const livePosts = (post) => post.date <= now && !post.data.draft;
+ config.addCollection('posts', (collection) => {
return [
- ...collection.getFilteredByGlob('./src/posts/*.md').filter(livePosts)
+ ...collection.getFilteredByGlob('./src/posts/*.md').filter(livePosts),
].reverse();
});
- config.addCollection('demos', collection => {
+ config.addCollection('demos', (collection) => {
return [...collection.getFilteredByGlob('./src/demos/*.md')].reverse();
});
- config.addCollection('postFeed', collection => {
+ config.addCollection('postFeed', (collection) => {
return [...collection.getFilteredByGlob('./src/posts/*.md').filter(livePosts)]
.reverse()
.slice(0, site.maxPostsPerPage);
});
- config.addCollection('docs', collection => {
+ config.addCollection('docs', (collection) => {
return [...collection.getFilteredByGlob('./src/docs/*.md')].reverse();
});
- config.addCollection('docsOrdered', collection => {
+ config.addCollection('docsOrdered', (collection) => {
const docs = collection.getFilteredByGlob('src/docs/*.md').sort((a, b) => {
return Number(a.data.order) - Number(b.data.order);
});
@@ -74,7 +74,7 @@ module.exports = function(config) {
// 404
config.setBrowserSyncConfig({
callbacks: {
- ready: function(err, browserSync) {
+ ready: function (err, browserSync) {
const content_404 = fs.readFileSync('dist/404.html');
browserSync.addMiddleware('*', (req, res) => {
@@ -82,15 +82,15 @@ module.exports = function(config) {
res.write(content_404);
res.end();
});
- }
- }
+ },
+ },
});
return {
dir: {
input: 'src',
- output: 'dist'
+ output: 'dist',
},
- passthroughFileCopy: true
+ passthroughFileCopy: true,
};
};
diff --git a/packages/docs/rollup.config.js b/packages/docs/rollup.config.js
index 7f62e07f4..38dd88349 100644
--- a/packages/docs/rollup.config.js
+++ b/packages/docs/rollup.config.js
@@ -4,16 +4,11 @@ const nodeResolve = require('rollup-plugin-node-resolve');
const json = require('rollup-plugin-json');
export default {
- input: 'src/admin/util',
- output: {
- file: 'dist/admin/util.js',
- format: 'iife',
- name: 'previewUtil',
- },
- plugins: [
- builtins(),
- nodeResolve(),
- commonjs(),
- json(),
- ]
+ input: 'src/admin/util',
+ output: {
+ file: 'dist/admin/util.js',
+ format: 'iife',
+ name: 'previewUtil',
+ },
+ plugins: [builtins(), nodeResolve(), commonjs(), json()],
};
diff --git a/packages/docs/src/_data/global.js b/packages/docs/src/_data/global.js
index 683a0a332..3b6371b17 100644
--- a/packages/docs/src/_data/global.js
+++ b/packages/docs/src/_data/global.js
@@ -1,9 +1,9 @@
module.exports = {
- random() {
- const segment = () => {
- return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
- };
- return `${segment()}-${segment()}-${segment()}`;
- },
- now: Date.now()
+ random() {
+ const segment = () => {
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
+ };
+ return `${segment()}-${segment()}-${segment()}`;
+ },
+ now: Date.now(),
};
diff --git a/packages/docs/src/_data/helpers.js b/packages/docs/src/_data/helpers.js
index 9ae9b7883..97543eaaa 100644
--- a/packages/docs/src/_data/helpers.js
+++ b/packages/docs/src/_data/helpers.js
@@ -1,10 +1,10 @@
module.exports = {
- getNextHeadingLevel(currentLevel) {
- return parseInt(currentLevel, 10) + 1;
- },
- getReadingTime(text) {
- const wordsPerMinute = 200;
- const numberOfWords = text.split(/\s/g).length;
- return Math.ceil(numberOfWords / wordsPerMinute);
- }
+ getNextHeadingLevel(currentLevel) {
+ return parseInt(currentLevel, 10) + 1;
+ },
+ getReadingTime(text) {
+ const wordsPerMinute = 200;
+ const numberOfWords = text.split(/\s/g).length;
+ return Math.ceil(numberOfWords / wordsPerMinute);
+ },
};
diff --git a/packages/docs/src/_data/styleguide.js b/packages/docs/src/_data/styleguide.js
index 4969bec39..de64437d5 100644
--- a/packages/docs/src/_data/styleguide.js
+++ b/packages/docs/src/_data/styleguide.js
@@ -1,28 +1,28 @@
const tokens = require('./tokens.json');
module.exports = {
- colors() {
- let response = [];
+ colors() {
+ let response = [];
- Object.keys(tokens.colors).forEach(key => {
- response.push({
- value: tokens.colors[key],
- key
- });
- });
+ Object.keys(tokens.colors).forEach((key) => {
+ response.push({
+ value: tokens.colors[key],
+ key,
+ });
+ });
- return response;
- },
- sizes() {
- let response = [];
+ return response;
+ },
+ sizes() {
+ let response = [];
- Object.keys(tokens['size-scale']).forEach(key => {
- response.push({
- value: tokens['size-scale'][key],
- key
- });
- });
+ Object.keys(tokens['size-scale']).forEach((key) => {
+ response.push({
+ value: tokens['size-scale'][key],
+ key,
+ });
+ });
- return response;
- }
+ return response;
+ },
};
diff --git a/packages/docs/src/admin/previews.js b/packages/docs/src/admin/previews.js
index 82dcd1f2c..9fa3d7589 100644
--- a/packages/docs/src/admin/previews.js
+++ b/packages/docs/src/admin/previews.js
@@ -7,82 +7,82 @@ env.addFilter('markdownFilter', markdownFilter);
env.addFilter('dateFilter', dateFilter);
const Preview = ({entry, path, context}) => {
- const data = context(entry.get('data').toJS());
- const html = env.render(path, {...data, helpers});
- return ;
+ const data = context(entry.get('data').toJS());
+ const html = env.render(path, {...data, helpers});
+ return ;
};
const Home = ({entry}) => (
- ({
- title,
- content: markdownFilter(body),
- postsHeading,
- archiveButtonText,
- collections: {
- postFeed: [
- {
- url: 'javascript:void(0)',
- date: new Date(),
- data: {
- title: 'Sample Post'
- }
- }
- ]
- }
- })}
- />
+ ({
+ title,
+ content: markdownFilter(body),
+ postsHeading,
+ archiveButtonText,
+ collections: {
+ postFeed: [
+ {
+ url: 'javascript:void(0)',
+ date: new Date(),
+ data: {
+ title: 'Sample Post',
+ },
+ },
+ ],
+ },
+ })}
+ />
);
const Post = ({entry}) => (
- ({
- title,
- date,
- content: markdownFilter(body || '')
- })}
- />
+ ({
+ title,
+ date,
+ content: markdownFilter(body || ''),
+ })}
+ />
);
const Page = ({entry}) => (
- ({
- title,
- content: markdownFilter(body || '')
- })}
- />
+ ({
+ title,
+ content: markdownFilter(body || ''),
+ })}
+ />
);
const SiteData = ({entry}) => (
- ({
- site: {
- name,
- shortDesc,
- showThemeCredit
- }
- })}
- />
+ ({
+ site: {
+ name,
+ shortDesc,
+ showThemeCredit,
+ },
+ })}
+ />
);
const Nav = ({entry}) => (
- ({
- navigation: {
- items
- }
- })}
- />
+ ({
+ navigation: {
+ items,
+ },
+ })}
+ />
);
CMS.registerPreviewTemplate('home', Home);
diff --git a/packages/docs/src/admin/util.js b/packages/docs/src/admin/util.js
index 302b159cf..53db2e8ec 100644
--- a/packages/docs/src/admin/util.js
+++ b/packages/docs/src/admin/util.js
@@ -3,9 +3,4 @@ import dateFilter from '../filters/date-filter';
import markdownFilter from '../filters/markdown-filter';
import w3DateFilter from '../filters/w3-date-filter';
-export {
- helpers,
- dateFilter,
- markdownFilter,
- w3DateFilter,
-};
+export {helpers, dateFilter, markdownFilter, w3DateFilter};
diff --git a/packages/docs/src/filters/date-filter.js b/packages/docs/src/filters/date-filter.js
index 5206da52f..2b4904744 100644
--- a/packages/docs/src/filters/date-filter.js
+++ b/packages/docs/src/filters/date-filter.js
@@ -1,15 +1,28 @@
// Stolen from https://stackoverflow.com/a/31615643
-const appendSuffix = n => {
- var s = ['th', 'st', 'nd', 'rd'],
- v = n % 100;
- return n + (s[(v - 20) % 10] || s[v] || s[0]);
+const appendSuffix = (n) => {
+ var s = ['th', 'st', 'nd', 'rd'],
+ v = n % 100;
+ return n + (s[(v - 20) % 10] || s[v] || s[0]);
};
module.exports = function dateFilter(value) {
- const dateObject = new Date(value);
+ const dateObject = new Date(value);
- const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
- const dayWithSuffix = appendSuffix(dateObject.getDate());
+ const months = [
+ 'January',
+ 'February',
+ 'March',
+ 'April',
+ 'May',
+ 'June',
+ 'July',
+ 'August',
+ 'September',
+ 'October',
+ 'November',
+ 'December',
+ ];
+ const dayWithSuffix = appendSuffix(dateObject.getDate());
- return `${dayWithSuffix} ${months[dateObject.getMonth()]} ${dateObject.getFullYear()}`;
+ return `${dayWithSuffix} ${months[dateObject.getMonth()]} ${dateObject.getFullYear()}`;
};
diff --git a/packages/docs/src/filters/markdown-filter.js b/packages/docs/src/filters/markdown-filter.js
index 530c2f571..e2298ce25 100644
--- a/packages/docs/src/filters/markdown-filter.js
+++ b/packages/docs/src/filters/markdown-filter.js
@@ -1,9 +1,9 @@
const markdownIt = require('markdown-it')({
- html: true,
- breaks: true,
- linkify: true
+ html: true,
+ breaks: true,
+ linkify: true,
});
module.exports = function markdown(value) {
- return markdownIt.render(value);
+ return markdownIt.render(value);
};
diff --git a/packages/docs/src/filters/w3-date-filter.js b/packages/docs/src/filters/w3-date-filter.js
index d31538da4..39c0f7ca8 100644
--- a/packages/docs/src/filters/w3-date-filter.js
+++ b/packages/docs/src/filters/w3-date-filter.js
@@ -1,5 +1,5 @@
module.exports = function w3cDate(value) {
- const dateObject = new Date(value);
+ const dateObject = new Date(value);
- return dateObject.toISOString();
+ return dateObject.toISOString();
};
diff --git a/packages/docs/src/js/components/theme-toggle.js b/packages/docs/src/js/components/theme-toggle.js
index 7e93571a2..63d6fb387 100644
--- a/packages/docs/src/js/components/theme-toggle.js
+++ b/packages/docs/src/js/components/theme-toggle.js
@@ -2,97 +2,97 @@
const html = String.raw;
class ThemeToggle extends HTMLElement {
- constructor() {
- super();
-
- this.STORAGE_KEY = 'user-color-scheme';
- this.COLOR_MODE_KEY = '--color-mode';
- }
-
- connectedCallback() {
- this.render();
- }
-
- getCSSCustomProp(propKey) {
- let response = getComputedStyle(document.documentElement).getPropertyValue(propKey);
-
- // Tidy up the string if there’s something to work with
- if (response.length) {
- response = response.replace(/\'|"/g, '').trim();
- }
-
- // Return the string response by default
- return response;
- }
-
- applySetting(passedSetting) {
- let currentSetting = passedSetting || localStorage.getItem(this.STORAGE_KEY);
-
- if (currentSetting) {
- document.documentElement.setAttribute('data-user-color-scheme', currentSetting);
- this.setButtonLabelAndStatus(currentSetting);
- } else {
- this.setButtonLabelAndStatus(this.getCSSCustomProp(this.COLOR_MODE_KEY));
- }
- }
-
- toggleSetting() {
- let currentSetting = localStorage.getItem(this.STORAGE_KEY);
-
- switch (currentSetting) {
- case null:
- currentSetting =
- this.getCSSCustomProp(this.COLOR_MODE_KEY) === 'dark' ? 'light' : 'dark';
- break;
- case 'light':
- currentSetting = 'dark';
- break;
- case 'dark':
- currentSetting = 'light';
- break;
- }
-
- localStorage.setItem(this.STORAGE_KEY, currentSetting);
-
- return currentSetting;
- }
-
- setButtonLabelAndStatus(currentSetting) {
- this.modeToggleButton.innerText = `${
- currentSetting === 'dark' ? 'Light' : 'Dark'
- } theme`;
- this.modeStatusElement.innerText = `Color mode is now "${currentSetting}"`;
- }
-
- render() {
- this.innerHTML = html`
-