-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Nakira/patch-1
Update dropdowns.pug
- Loading branch information
Showing
4 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
var assert = require("assert"); | ||
var jade = require("pug"); | ||
var fs = require("fs"); | ||
var path = require("path"); | ||
|
||
describe("Dropdowns", function () { | ||
|
||
function generateItems(count) { | ||
var items = []; | ||
for (var i = 0; i < count; i++) { | ||
items[i] = { | ||
url: 'url' + i, | ||
text: 'text' + i | ||
} | ||
} | ||
return items; | ||
} | ||
it("should generate a dropdown", function () { | ||
var locals = { | ||
caption: "dropdown caption", | ||
items: generateItems() | ||
}; | ||
var fn = jade.compileFile(path.join(__dirname, "fixtures/dropdowns/dropdown.pug")); | ||
assert.equal('<div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">dropdown caption <span class="caret"></span></button><ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1"></ul></div>', fn(locals)); | ||
}); | ||
it("should generate a dropup", function () { | ||
var locals = { | ||
caption: "dropup caption", | ||
items: generateItems() | ||
}; | ||
var fn = jade.compileFile(path.join(__dirname, "fixtures/dropdowns/dropup.pug")); | ||
assert.equal('<div class="dropup"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">dropup caption <span class="caret"></span></button><ul class="dropdown-menu" role="menu" aria-labelledby="dropupMenu1"></ul></div>', fn(locals)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include ../../../components/dropdowns.pug | ||
+dropdown(caption,items) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include ../../../components/dropdowns.pug | ||
+dropup(caption,items) |