2021-06-07 22:22:06 +03:00
|
|
|
const should = require('should');
|
|
|
|
const sinon = require('sinon');
|
|
|
|
const _ = require('lodash');
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
const matchHelper = require('../../../../core/frontend/helpers/match');
|
|
|
|
const titleHelper = require('../../../../core/frontend/helpers/title');
|
2021-10-06 12:52:46 +03:00
|
|
|
const labs = require('../../../../core/shared/labs');
|
|
|
|
const handlebars = require('../../../../core/frontend/services/theme-engine/engine').handlebars;
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
const {SafeString} = require('express-hbs');
|
2021-06-07 22:22:06 +03:00
|
|
|
|
|
|
|
describe('Match helper', function () {
|
|
|
|
before(function () {
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
handlebars.registerHelper('match', matchHelper);
|
|
|
|
handlebars.registerHelper('title', titleHelper);
|
2021-06-07 22:22:06 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function () {
|
|
|
|
sinon.restore();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
sinon.stub(labs, 'isSet').returns(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
function shouldCompileToExpected(templateString, hash, expected) {
|
|
|
|
const template = handlebars.compile(templateString);
|
|
|
|
const result = template(hash);
|
|
|
|
|
|
|
|
result.should.eql(expected);
|
|
|
|
}
|
|
|
|
|
2021-09-16 19:11:10 +03:00
|
|
|
/**
|
|
|
|
* Run tests takes a list of tests & a data hash in the form of two objects
|
|
|
|
* The key is the template string, the value is the expected value when the template is compiled with the given hash object
|
|
|
|
*
|
|
|
|
* @param {object} tests
|
|
|
|
* @param {object} hash
|
|
|
|
*/
|
|
|
|
function runTests(tests, hash) {
|
|
|
|
_.each(tests, (expectedString, templateString) => {
|
|
|
|
it(`${templateString} resolves to '${expectedString}'`, function () {
|
|
|
|
shouldCompileToExpected(templateString, hash, expectedString);
|
|
|
|
});
|
2021-06-07 22:22:06 +03:00
|
|
|
});
|
2021-09-16 19:11:10 +03:00
|
|
|
}
|
2021-06-07 22:22:06 +03:00
|
|
|
|
2021-09-16 19:11:10 +03:00
|
|
|
// The match helper, by default, is an inline helper that returns either true or false (as a string) for any given set of arguments.
|
|
|
|
// In the first instance, the unit tests should check various combinations of arguments to ensure we get the right answer
|
2021-06-07 22:22:06 +03:00
|
|
|
describe('{{match}} (inline)', function () {
|
2021-09-16 19:11:10 +03:00
|
|
|
const hash = {
|
|
|
|
truthy_bool: true,
|
|
|
|
falsy_bool: false,
|
|
|
|
zero: 0,
|
|
|
|
one: 1,
|
|
|
|
string: 'Hello world',
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
title: 'The Title',
|
|
|
|
string_true: 'true',
|
|
|
|
string_false: 'false',
|
|
|
|
safestring_string_true: new SafeString('true'),
|
|
|
|
safestring_string_false: new SafeString('false'),
|
|
|
|
safestring_bool_true: new SafeString(true),
|
|
|
|
safestring_bool_false: new SafeString(false),
|
2021-09-16 19:11:10 +03:00
|
|
|
five: 5,
|
|
|
|
string_five: '5',
|
|
|
|
empty: '',
|
|
|
|
null: null,
|
|
|
|
object: {
|
|
|
|
foo: 'foo',
|
|
|
|
bar: 'bar'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-09-17 11:47:10 +03:00
|
|
|
describe('Basic values', function () {
|
|
|
|
runTests({
|
|
|
|
'{{match truthy_bool}}': 'true',
|
|
|
|
'{{match falsy_bool}}': 'false',
|
|
|
|
'{{match one}}': 'true',
|
|
|
|
'{{match zero}}': 'false',
|
|
|
|
'{{match string}}': 'true',
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
'{{match string_true}}': 'true',
|
|
|
|
'{{match string_false}}': 'true',
|
|
|
|
'{{match safestring_string_true}}': 'true',
|
|
|
|
'{{match safestring_string_false}}': 'true',
|
|
|
|
'{{match safestring_bool_true}}': 'true',
|
|
|
|
'{{match safestring_bool_false}}': 'false',
|
2021-09-17 11:47:10 +03:00
|
|
|
'{{match empty}}': 'false',
|
|
|
|
'{{match null}}': 'false',
|
|
|
|
'{{match undefined}}': 'false',
|
|
|
|
'{{match unknown}}': 'false',
|
|
|
|
'{{match object}}': 'true',
|
|
|
|
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
'{{match (title)}}': 'true',
|
|
|
|
|
2021-09-17 11:47:10 +03:00
|
|
|
// Zero works if includeZero is set
|
|
|
|
'{{match zero includeZero=true}}': 'true',
|
|
|
|
|
|
|
|
// Nesting the helper should still resolve correctly
|
|
|
|
'{{match (match truthy_bool)}}': 'true',
|
|
|
|
'{{match (match falsy_bool)}}': 'false'
|
|
|
|
}, hash);
|
|
|
|
});
|
2021-09-16 19:11:10 +03:00
|
|
|
|
|
|
|
// @TODO: Implement Implicit Equals
|
|
|
|
// describe('Implicit Equals', function () {
|
|
|
|
// runTests({
|
|
|
|
// '{{match string "Hello world"}}': 'true',
|
|
|
|
// '{{match string "Hello world!"}}': 'false',
|
|
|
|
// }, hash);
|
|
|
|
// });
|
|
|
|
|
|
|
|
describe('Explicit Equals', function () {
|
|
|
|
runTests({
|
|
|
|
'{{match string "=" "Hello world"}}': 'true',
|
|
|
|
'{{match string "=" "Hello world!"}}': 'false',
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
'{{match string_true "=" "true"}}': 'true',
|
|
|
|
'{{match string_true "=" true}}': 'false',
|
|
|
|
'{{match string_false "=" "false"}}': 'true',
|
|
|
|
'{{match string_false "=" false}}': 'false',
|
|
|
|
'{{match safestring_string_true "=" "true"}}': 'true',
|
|
|
|
'{{match safestring_string_true "=" true}}': 'false',
|
|
|
|
'{{match safestring_string_false "=" "false"}}': 'true',
|
|
|
|
'{{match safestring_string_false "=" false}}': 'false',
|
|
|
|
'{{match safestring_bool_true "=" "true"}}': 'false',
|
|
|
|
'{{match safestring_bool_true "=" true}}': 'true',
|
|
|
|
'{{match safestring_bool_false "=" "false"}}': 'false',
|
|
|
|
'{{match safestring_bool_false "=" false}}': 'true',
|
2021-09-16 19:11:10 +03:00
|
|
|
'{{match truthy_bool "=" true}}': 'true',
|
|
|
|
'{{match truthy_bool "=" false}}': 'false',
|
|
|
|
'{{match falsy_bool "=" false}}': 'true',
|
|
|
|
'{{match falsy_bool "=" true}}': 'false',
|
|
|
|
'{{match one "=" 1}}': 'true',
|
|
|
|
'{{match one "=" "1"}}': 'false',
|
|
|
|
'{{match zero "=" 0}}': 'true',
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
'{{match zero "=" "0"}}': 'false',
|
|
|
|
|
|
|
|
'{{match (title) "=" "The Title"}}': 'true',
|
|
|
|
'{{match (title) "=" "The Title!"}}': 'false'
|
2021-09-16 19:11:10 +03:00
|
|
|
}, hash);
|
2021-06-07 22:22:06 +03:00
|
|
|
});
|
|
|
|
|
2021-09-16 19:11:10 +03:00
|
|
|
describe('Explicit Not Equals', function () {
|
|
|
|
runTests({
|
|
|
|
'{{match string "!=" "Hello world"}}': 'false',
|
|
|
|
'{{match string "!=" "Hello world!"}}': 'true',
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
'{{match string_true "!=" true}}': 'true',
|
|
|
|
'{{match string_true "!=" "true"}}': 'false',
|
|
|
|
'{{match string_false "!=" false}}': 'true',
|
|
|
|
'{{match string_false "!=" "false"}}': 'false',
|
|
|
|
'{{match safestring_string_true "!=" "true"}}': 'false',
|
|
|
|
'{{match safestring_string_true "!=" true}}': 'true',
|
|
|
|
'{{match safestring_string_false "!=" "false"}}': 'false',
|
|
|
|
'{{match safestring_string_false "!=" false}}': 'true',
|
|
|
|
'{{match safestring_bool_true "!=" "true"}}': 'true',
|
|
|
|
'{{match safestring_bool_true "!=" true}}': 'false',
|
|
|
|
'{{match safestring_bool_false "!=" "false"}}': 'true',
|
|
|
|
'{{match safestring_bool_false "!=" false}}': 'false',
|
2021-09-16 19:11:10 +03:00
|
|
|
'{{match truthy_bool "!=" true}}': 'false',
|
|
|
|
'{{match truthy_bool "!=" false}}': 'true',
|
|
|
|
'{{match falsy_bool "!=" false}}': 'false',
|
|
|
|
'{{match falsy_bool "!=" true}}': 'true',
|
|
|
|
'{{match one "!=" 1}}': 'false',
|
|
|
|
'{{match one "!=" "1"}}': 'true',
|
|
|
|
'{{match zero "!=" 0}}': 'false',
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
'{{match zero "!=" "0"}}': 'true',
|
|
|
|
|
|
|
|
'{{match (title) "!=" "The Title"}}': 'false',
|
|
|
|
'{{match (title) "!=" "The Title!"}}': 'true'
|
2021-09-16 19:11:10 +03:00
|
|
|
}, hash);
|
2021-06-07 22:22:06 +03:00
|
|
|
});
|
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759
- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in
The logic
- Figuring out the correct logic here has been a little tricky but essentially:
- {{match safestring}} with a single arg, will return true for any truthy value
- {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
- {{match (match something) "=" true}} will therefore work for any level of nesting
- this can result in slightly inconsistent results, but feels correct and documentable
This is documented extensively through the test cases
2021-10-14 13:04:44 +03:00
|
|
|
|
|
|
|
// SafeStrings represent the original value as an object for example:
|
|
|
|
// SafeString { string: true } vs SafeString { string: 'true' }
|
|
|
|
// allows us to know if the original value was a boolean or a string
|
|
|
|
// These tests make sure that we can compare to the _originaL_ value
|
|
|
|
// But that we don't start allowing weird things like boolean true being equal to string true
|
|
|
|
describe('SafeString behaviour makes sense(ish)', function () {
|
|
|
|
runTests({
|
|
|
|
// Title equals true value = true
|
|
|
|
'{{match (match title "=" "The Title") "=" "true"}}': 'false',
|
|
|
|
'{{match (match title "=" "The Title") "=" true}}': 'true',
|
|
|
|
'{{match (match title "=" "The Title")}}': 'true',
|
|
|
|
// With title as a helper that also outputs a SafeString
|
|
|
|
'{{match (match (title) "=" "The Title") "=" "true"}}': 'false',
|
|
|
|
'{{match (match (title) "=" "The Title") "=" true}}': 'true',
|
|
|
|
'{{match (match (title) "=" "The Title")}}': 'true',
|
|
|
|
|
|
|
|
// Title equals false value = true
|
|
|
|
'{{match (match title "=" "The Title!") "=" "false"}}': 'false',
|
|
|
|
'{{match (match title "=" "The Title!") "=" false}}': 'true',
|
|
|
|
'{{match (match title "=" "The Title!")}}': 'false',
|
|
|
|
// With title as a helper that also outputs a SafeString
|
|
|
|
'{{match (match (title) "=" "The Title!") "=" "false"}}': 'false',
|
|
|
|
'{{match (match (title) "=" "The Title!") "=" false}}': 'true',
|
|
|
|
'{{match (match (title) "=" "The Title!")}}': 'false',
|
|
|
|
|
|
|
|
// // Reverse, reverse!
|
|
|
|
// // Title not equals true value = false
|
|
|
|
'{{match (match title "!=" "The Title") "=" "false"}}': 'false',
|
|
|
|
'{{match (match title "!=" "The Title") "=" false}}': 'true',
|
|
|
|
'{{match (match title "!=" "The Title")}}': 'false',
|
|
|
|
// With title as a helper that also outputs a SafeString
|
|
|
|
'{{match (match (title) "!=" "The Title") "=" "false"}}': 'false',
|
|
|
|
'{{match (match (title) "!=" "The Title") "=" false}}': 'true',
|
|
|
|
'{{match (match (title) "!=" "The Title")}}': 'false',
|
|
|
|
|
|
|
|
// Yoda a complex example or two to prove this works
|
|
|
|
'{{match false "=" (match title "!=" "The Title")}}': 'true',
|
|
|
|
'{{match "false" "=" (match (title) "!=" "The Title")}}': 'false'
|
|
|
|
}, {title: 'The Title'});
|
|
|
|
});
|
2021-09-16 19:11:10 +03:00
|
|
|
});
|
2021-06-07 22:22:06 +03:00
|
|
|
|
2021-09-16 19:11:10 +03:00
|
|
|
// By using match as a block helper, instead of returning true or false, the matching template is executed
|
|
|
|
// We've already tested all the logic of the matches, for the block helpers we only need to test that the correct template is executed
|
|
|
|
// These tests are more explicit so it's clear what functionality we're trying to test
|
|
|
|
describe('{{#match}} (block)', function () {
|
|
|
|
const templateString = '{{#match title "=" "Hello World"}}case a{{else match title "=" "Hello World!"}}case b{{else}}case c{{/match}}';
|
2021-06-07 22:22:06 +03:00
|
|
|
|
2021-09-16 19:11:10 +03:00
|
|
|
it('Executes the first block when match is true', function () {
|
|
|
|
const title = 'Hello World';
|
|
|
|
const expected = 'case a';
|
2021-06-07 22:22:06 +03:00
|
|
|
|
2021-09-16 19:11:10 +03:00
|
|
|
shouldCompileToExpected(templateString, {title}, expected);
|
2021-06-07 22:22:06 +03:00
|
|
|
});
|
|
|
|
|
2021-09-16 19:11:10 +03:00
|
|
|
it('Executes secondary blocks correctly', function () {
|
|
|
|
const title = 'Hello World!';
|
|
|
|
const expected = 'case b';
|
2021-06-07 22:22:06 +03:00
|
|
|
|
2021-09-16 19:11:10 +03:00
|
|
|
shouldCompileToExpected(templateString, {title}, expected);
|
2021-06-07 22:22:06 +03:00
|
|
|
});
|
|
|
|
|
2021-09-16 19:11:10 +03:00
|
|
|
it('Executes the else block when match is false', function () {
|
|
|
|
const title = 'Hello';
|
|
|
|
const expected = 'case c';
|
2021-06-07 22:22:06 +03:00
|
|
|
|
2021-09-16 19:11:10 +03:00
|
|
|
shouldCompileToExpected(templateString, {title}, expected);
|
2021-06-07 22:22:06 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|