Skip to content

Commit 23ebb8d

Browse files
committed
Enable additional spec tests
1 parent 10042a6 commit 23ebb8d

1 file changed

Lines changed: 18 additions & 25 deletions

File tree

tests/HandlebarsSpecTest.php

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,34 +46,26 @@ public function testSpecs(array $spec): void
4646

4747
// Fix {} for these test cases
4848
if (
49-
($spec['it'] === 'should override template partials') ||
50-
($spec['it'] === 'should override partials down the entire stack') ||
51-
($spec['it'] === 'should define inline partials for block')
49+
$spec['it'] === 'should override template partials' ||
50+
$spec['it'] === 'should override partials down the entire stack' ||
51+
$spec['it'] === 'should define inline partials for block'
5252
) {
5353
$spec['data'] = new \stdClass();
5454
}
5555

56-
//// Skip bad specs
57-
// 1. No expected nor exception in spec
58-
if (!isset($spec['expected']) && !isset($spec['exception'])) {
59-
$this->markTestIncomplete("Skip [{$spec['file']}#{$spec['description']}]#{$spec['no']} , no expected result in spec, skip.");
60-
}
61-
6256
// 2. Not supported case: foo/bar path
6357
if (
64-
($spec['it'] === 'literal paths') ||
65-
($spec['it'] === 'this keyword nested inside path') ||
66-
($spec['it'] === 'this keyword nested inside helpers param') ||
67-
($spec['it'] === 'parameter data throws when using complex scope references') ||
68-
($spec['it'] === 'block with complex lookup using nested context')
58+
$spec['it'] === 'literal paths' ||
59+
$spec['it'] === 'this keyword nested inside path' ||
60+
$spec['it'] === 'this keyword nested inside helpers param' ||
61+
$spec['it'] === 'parameter data throws when using complex scope references' ||
62+
$spec['it'] === 'block with complex lookup using nested context'
6963
) {
7064
$this->markTestIncomplete('Not supported case: foo/bar path');
7165
}
7266

7367
// 4. block parameters, special case now do not support
74-
if (
75-
($spec['it'] === 'should not take presedence over pathed values')
76-
) {
68+
if ($spec['it'] === 'should not take presedence over pathed values') {
7769
$this->markTestIncomplete('Not supported case: just skip it');
7870
}
7971

@@ -100,7 +92,7 @@ public function testSpecs(array $spec): void
10092
$spec['it'] === 'in string params mode,' ||
10193

10294
// Decorators are deprecated: https://github.com/wycats/handlebars.js/blob/master/docs/decorators-api.md
103-
($spec['description'] === 'blocks - decorators') ||
95+
$spec['description'] === 'blocks - decorators' ||
10496

10597
// strict mode
10698
(
@@ -117,22 +109,23 @@ public function testSpecs(array $spec): void
117109
$this->markTestIncomplete('Not supported case: just skip it');
118110
}
119111

120-
// TODO: require fix
121112
if (
122113
// inline partials
123114
str_starts_with($spec['it'], 'should render nested inline partials') ||
124115
$spec['it'] === 'should define inline partials for block' && isset($spec['number']) ||
125-
126-
// SafeString
127-
($spec['it'] === 'rendering function partial in vm mode') ||
116+
$spec['it'] === 'rendering function partial in vm mode' ||
128117

129118
// todo: fix
130119
$spec['it'] === 'each with block params' ||
131120
$spec['it'] === 'pathed lambas with parameters' ||
132121
$spec['it'] === 'lambdas are resolved by blockHelperMissing, not handlebars proper' ||
133122
$spec['description'] === 'helpers - the lookupProperty-option' ||
134123

135-
// need confirm
124+
// need confirm
125+
$spec['it'] === 'GH-1341: 4.0.7 release breaks {{#if @partial-block}} usage' ||
126+
$spec['it'] === 'GH-1186: Support block params for existing programs' ||
127+
$spec['it'] === 'GH-1135 : Context handling within each iteration' ||
128+
$spec['it'] === "bug reported by @fat where lambdas weren't being properly resolved" ||
136129
$spec['it'] === 'if with function argument' ||
137130
$spec['it'] === 'with with function argument' ||
138131
$spec['it'] === 'each with function argument' && !isset($spec['number']) ||
@@ -146,7 +139,7 @@ public function testSpecs(array $spec): void
146139

147140
// FIX SPEC
148141
if ($spec['it'] === 'should take presednece over parent block params') {
149-
$spec['helpers']['goodbyes']['php'] = 'function($options) { static $value; if($value === null) { $value = 1; } return $options->fn(array("value" => "bar"), array("blockParams" => ($options->blockParams === 1) ? array($value++, $value++) : null));}';
142+
$spec['helpers']['goodbyes']['php'] = 'function($options) { static $value; if ($value === null) { $value = 1; } return $options->fn(["value" => "bar"], ["blockParams" => $options->blockParams === 1 ? [$value++, $value++] : null]);}';
150143
}
151144
if ($spec['it'] === 'depthed block functions without context argument' && $spec['expected'] === 'inner') {
152145
$spec['expected'] = '';
@@ -269,7 +262,7 @@ public static function jsonSpecProvider(): array
269262

270263
// stringParams and trackIds mode were removed from Handlebars in 2015:
271264
// https://github.com/handlebars-lang/handlebars.js/pull/1148
272-
$skip = ['parser', 'regressions', 'tokenizer', 'string-params', 'track-ids'];
265+
$skip = ['parser', 'tokenizer', 'string-params', 'track-ids'];
273266

274267
foreach (glob('vendor/jbboehr/handlebars-spec/spec/*.json') as $file) {
275268
$name = basename($file, '.json');

0 commit comments

Comments
 (0)