Skip to content

Commit b193487

Browse files
committed
removes encoded underscore test and implementation for shouldIgnore helper
1 parent cc92c06 commit b193487

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

lib/helpers/raw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ exports.shouldIgnore = function(filePath){
476476

477477
// test for starting underscore, .git, .gitignore
478478
var map = arr.map(function(item){
479-
return item[0] === "_" || item.indexOf(".git") === 0
479+
return item[0] === "_" || item.indexOf("%5f") === 0 || item.indexOf(".git") === 0
480480
})
481481

482482
// return if any item starts with underscore

test/fixtures/templates/filters.jade

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
div.foo
2+
:markdown
3+
# hello markdown

test/helpers.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ describe("helpers", function(){
162162

163163
it('should return true if file begins with underscore.', function(done){
164164
polymer.helpers.shouldIgnore('_foo.html').should.be.true
165+
polymer.helpers.shouldIgnore('%5ffoo.html').should.be.true
165166
done()
166167
})
167168

@@ -170,6 +171,10 @@ describe("helpers", function(){
170171
polymer.helpers.shouldIgnore('foo_.html').should.be.false
171172
polymer.helpers.shouldIgnore('f_oo.html').should.be.false
172173
polymer.helpers.shouldIgnore('f____.html').should.be.false
174+
polymer.helpers.shouldIgnore('foo.html').should.be.false
175+
polymer.helpers.shouldIgnore('foo%5f.html').should.be.false
176+
polymer.helpers.shouldIgnore('f%5foo.html').should.be.false
177+
polymer.helpers.shouldIgnore('f%5f%5f%5f%5f.html').should.be.false
173178
done()
174179
})
175180

@@ -178,30 +183,33 @@ describe("helpers", function(){
178183
polymer.helpers.shouldIgnore(path.join('foo', '_bar', 'baz.html')).should.be.true
179184
polymer.helpers.shouldIgnore(path.join('_foo', 'bar', 'baz.html')).should.be.true
180185
polymer.helpers.shouldIgnore(path.sep + path.join('_foo', 'bar', 'baz.html')).should.be.true
186+
polymer.helpers.shouldIgnore(path.join('foo', '%5fbar.html')).should.be.true
187+
polymer.helpers.shouldIgnore(path.join('foo', '%5fbar', 'baz.html')).should.be.true
188+
polymer.helpers.shouldIgnore(path.join('%5ffoo', 'bar', 'baz.html')).should.be.true
189+
polymer.helpers.shouldIgnore(path.sep + path.join('%5ffoo', 'bar', 'baz.html')).should.be.true
181190
done()
182191
})
183192

184193
it('should ignore if starts with underscore.', function(done){
185-
var reply = polymer.helpers.shouldIgnore('_beep.json')
186-
reply.should.be.true
194+
polymer.helpers.shouldIgnore('_beep.json').should.be.true
195+
polymer.helpers.shouldIgnore('%5fbeep.json').should.be.true
187196
done()
188197
})
189198

190199
it('should not ignore if doesnt start with underscore.', function(done){
191-
var reply = polymer.helpers.shouldIgnore('boop.json')
192-
reply.should.be.false
200+
polymer.helpers.shouldIgnore('boop.json').should.be.false
193201
done()
194202
})
195203

196204
it('should ignore if nested file starts with underscore.', function(done){
197-
var reply = polymer.helpers.shouldIgnore(path.join('beep', '_boop.json'))
198-
reply.should.be.true
205+
polymer.helpers.shouldIgnore(path.join('beep', '_boop.json')).should.be.true
206+
polymer.helpers.shouldIgnore(path.join('beep', '%5fboop.json')).should.be.true
199207
done()
200208
})
201209

202210
it('should ignore any part of tree starts with underscore.', function(done){
203-
var reply = polymer.helpers.shouldIgnore(path.join('foo', '_bar', 'baz.json'))
204-
reply.should.be.true
211+
polymer.helpers.shouldIgnore(path.join('foo', '_bar', 'baz.json')).should.be.true
212+
polymer.helpers.shouldIgnore(path.join('foo', '%5fbar', 'baz.json')).should.be.true
205213
done()
206214
})
207215

@@ -224,8 +232,8 @@ describe("helpers", function(){
224232
})
225233

226234
it('should allow underscore in names.', function(done){
227-
var reply = polymer.helpers.shouldIgnore(path.join('foo_', 'beep.json'))
228-
reply.should.be.false
235+
polymer.helpers.shouldIgnore(path.join('foo_', 'beep.json')).should.be.false
236+
polymer.helpers.shouldIgnore(path.join('foo%5f', 'beep.json')).should.be.false
229237
done()
230238
})
231239

0 commit comments

Comments
 (0)