diff --git a/components/accordion.pug b/components/accordion.pug index c778537..b8277ea 100644 --- a/components/accordion.pug +++ b/components/accordion.pug @@ -5,7 +5,7 @@ mixin accordion(id) //- accordion-item mixin accordion-item(type,title,parent,expanded) - -var id = title.replace(/\s+/g,"") + -var id = title.replace(/[^a-zA-Z0-9]/g,'_') .panel(class="panel-"+type) .panel-heading(role="tab", id="heading"+title) h4.panel-title diff --git a/test/accordion.js b/test/accordion.js index dab259b..66a4f85 100644 --- a/test/accordion.js +++ b/test/accordion.js @@ -10,7 +10,7 @@ describe("Accordion",function() { +accordion-item(type,title,parent,expanded)`; fs.writeFileSync(path.join(__dirname,"fixtures/accordion","accordion.pug"),accordionTemplate); var fn = pug.compileFile(path.join(__dirname,"fixtures/accordion","accordion.pug")); - var actual = '
'; + var actual = ''; var locals = { id: "myaccordion",title:"My Accordion Item",type: "primary", parent: "myaccordion",expanded:false}; it("should generate an accordion",function() { assert.equal(actual,fn(locals)); @@ -20,7 +20,7 @@ describe("Accordion",function() { +accordion-item-primary(title,parent,expanded)`; fs.writeFileSync(path.join(__dirname, "fixtures/accordion","accordion-item-primary.pug"),accItemPrimary); fn = pug.compileFile(path.join(__dirname,"fixtures/accordion","accordion-item-primary.pug")); - actual = ''; + actual = ''; it("should generate a primary accordion item", function() { assert.equal(actual, fn(locals)); });