Skip to content

Commit 3e97c82

Browse files
Merge pull request #620 from benhalverson/removePatternStates
Remove pattern states
2 parents e7ad95e + 24b04af commit 3e97c82

File tree

3 files changed

+0
-65
lines changed

3 files changed

+0
-65
lines changed

core/lib/pattern_assembler.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,7 @@ const pattern_assembler = function () {
7878
}
7979
}
8080

81-
/*
82-
* Deprecated in favor of .md 'status' frontmatter inside a pattern. Still used for unit tests at this time.
83-
* Will be removed in future versions
84-
*/
85-
function setState(pattern, patternlab, displayDeprecatedWarning) {
86-
if (patternlab.config.patternStates && patternlab.config.patternStates[pattern.patternPartial]) {
8781

88-
if (displayDeprecatedWarning) {
89-
plutils.error("Deprecation Warning: Using patternlab-config.json patternStates object will be deprecated in favor of the state frontmatter key associated with individual pattern markdown files.");
90-
console.log("This feature will still work in it's current form this release (but still be overridden by the new parsing method), and will be removed in the future.");
91-
}
92-
93-
pattern.patternState = patternlab.config.patternStates[pattern.patternPartial];
94-
}
95-
}
9682

9783
function addPattern(pattern, patternlab) {
9884

@@ -315,9 +301,6 @@ const pattern_assembler = function () {
315301
return currentPattern;
316302
}
317303

318-
//see if this file has a state
319-
setState(currentPattern, patternlab, true);
320-
321304
//look for a json file for this template
322305
try {
323306
var jsonFilename = path.resolve(patternsPath, currentPattern.subdir, currentPattern.fileName + ".json");
@@ -585,9 +568,6 @@ const pattern_assembler = function () {
585568
find_list_items: function (pattern) {
586569
return pattern.findListItems();
587570
},
588-
setPatternState: function (pattern, patternlab, displayDeprecatedWarning) {
589-
setState(pattern, patternlab, displayDeprecatedWarning);
590-
},
591571
addPattern: function (pattern, patternlab) {
592572
addPattern(pattern, patternlab);
593573
},

patternlab-config.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
"ishMinimum": "240",
5151
"ishMaximum": "2600",
5252
"patternStateCascade": ["inprogress", "inreview", "complete"],
53-
"patternStates": {
54-
},
5553
"patternExportPatternPartials": [],
5654
"patternExportDirectory": "./pattern_exports/",
5755
"cacheBust": true,

test/pattern_assembler_tests.js

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -461,49 +461,6 @@ tap.test('processPatternRecursive - ensure deep-nesting works', function(test) {
461461
test.end();
462462
});
463463

464-
tap.test('setState - applies any patternState matching the pattern', function(test) {
465-
//arrange
466-
var pa = require('../core/lib/pattern_assembler');
467-
var pattern_assembler = new pa();
468-
var patternlab = {};
469-
patternlab.config = {};
470-
patternlab.config.patternStates = {};
471-
patternlab.config.patternStates["pages-homepage-emergency"] = "inprogress";
472-
473-
var pattern = {
474-
patternPartial: "pages-homepage-emergency"
475-
};
476-
477-
//act
478-
pattern_assembler.setPatternState(pattern, patternlab);
479-
480-
//assert
481-
test.equals(pattern.patternState, "inprogress");
482-
test.end();
483-
});
484-
485-
tap.test('setState - does not apply any patternState if nothing matches the pattern', function(test) {
486-
//arrange
487-
var pa = require('../core/lib/pattern_assembler');
488-
var pattern_assembler = new pa();
489-
var patternlab = {};
490-
patternlab.config = {};
491-
patternlab.config.patternStates = {};
492-
patternlab.config.patternStates["pages-homepage-emergency"] = "inprogress";
493-
494-
var pattern = {
495-
key: "pages-homepage",
496-
patternState: ""
497-
};
498-
499-
//act
500-
pattern_assembler.setPatternState(pattern, patternlab);
501-
502-
//assert
503-
test.equals(pattern.patternState, "");
504-
test.end();
505-
});
506-
507464
tap.test('parseDataLinks - replaces found link.* data for their expanded links', function(test) {
508465
//arrange
509466
var diveSync = require('diveSync');

0 commit comments

Comments
 (0)