From 7f23086245055d4f170f879f55ee0e17fccdc8e1 Mon Sep 17 00:00:00 2001 From: mike-goodwin Date: Wed, 23 Nov 2016 21:56:26 +0000 Subject: [PATCH 1/6] added VS Code launch config for debugging --- .vscode/launch.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..100b4da --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + // Use IntelliSense to learn about possible Node.js debug attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", + "runtimeExecutable": null, + "cwd": "${workspaceRoot}", + "args": [ + "-R", + "spec" + ] + }, + { + "type": "node", + "request": "attach", + "name": "Attach to Process", + "port": 5858 + } + ] +} \ No newline at end of file From a8401692faf0ac3139135a4e8d02dd7a899009f8 Mon Sep 17 00:00:00 2001 From: mike-goodwin Date: Wed, 23 Nov 2016 22:10:30 +0000 Subject: [PATCH 2/6] enhanced debug support --- .vscode/launch.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 100b4da..cb5a990 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,12 +8,14 @@ "type": "node", "request": "launch", "name": "Launch Program", - "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", + "program": "${workspaceRoot}\\node_modules\\mocha\\bin\\_mocha", "runtimeExecutable": null, "cwd": "${workspaceRoot}", "args": [ "-R", - "spec" + "spec", + "--colors", + "--no-timeouts" ] }, { From a5f5241145771f083f3c921d5a2ecd5e34238af6 Mon Sep 17 00:00:00 2001 From: mike-goodwin Date: Wed, 23 Nov 2016 22:11:36 +0000 Subject: [PATCH 3/6] changed name of launch cofig --- .vscode/launch.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index cb5a990..b21bb09 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ { "type": "node", "request": "launch", - "name": "Launch Program", + "name": "Run Tests", "program": "${workspaceRoot}\\node_modules\\mocha\\bin\\_mocha", "runtimeExecutable": null, "cwd": "${workspaceRoot}", From 38cfa13836b281dec888ac7a89a6a9aeea38a72b Mon Sep 17 00:00:00 2001 From: mike-goodwin Date: Thu, 24 Nov 2016 20:00:32 +0000 Subject: [PATCH 4/6] tests for navbars mixin --- components/navbar.pug | 18 +++-- test/fixtures/navbars/nav-divider.pug | 2 + test/fixtures/navbars/nav-header.pug | 2 + test/fixtures/navbars/nav-item-dropdown.pug | 2 + test/fixtures/navbars/navbar-fixed.pug | 2 + test/fixtures/navbars/navbar-item.pug | 2 + test/fixtures/navbars/navbar-static.pug | 2 + test/fixtures/navbars/navbar.pug | 2 + test/navbars.js | 77 +++++++++++++++++++++ 9 files changed, 102 insertions(+), 7 deletions(-) create mode 100644 test/fixtures/navbars/nav-divider.pug create mode 100644 test/fixtures/navbars/nav-header.pug create mode 100644 test/fixtures/navbars/nav-item-dropdown.pug create mode 100644 test/fixtures/navbars/navbar-fixed.pug create mode 100644 test/fixtures/navbars/navbar-item.pug create mode 100644 test/fixtures/navbars/navbar-static.pug create mode 100644 test/fixtures/navbars/navbar.pug create mode 100644 test/navbars.js diff --git a/components/navbar.pug b/components/navbar.pug index acca261..7fba406 100644 --- a/components/navbar.pug +++ b/components/navbar.pug @@ -18,11 +18,15 @@ mixin navbar(name, id, style, href) block mixin nav_item(href, active) - li(class=active): a( href=href ) - block + + if(active) + li(class="active"): a( href=href ): block + else + li: a( href=href ): block mixin nav_item_dropdown(href, active) - li(class=["dropdown", active]) + - var ddclass = active ? ["dropdown", "active"] : "dropdown" + li(class=ddclass) a.dropdown-toggle( href=href, data-toggle="dropdown", role="button", aria-expanded="false" )= attributes.label span.caret ul.dropdown-menu( role="menu" ) @@ -35,7 +39,7 @@ mixin nav_header li.dropdown-header block -mixin navbar-fixed(name,id,style) +mixin navbar-fixed(name,id,style,href) - var style = (typeof style === 'undefined') ? "default" : style nav( role="navigation", class=["navbar","navbar-fixed-top","navbar-" + style] ) .container @@ -45,12 +49,12 @@ mixin navbar-fixed(name,id,style) span.icon-bar span.icon-bar span.icon-bar - a.navbar-brand(href='#')= name + a.navbar-brand(href=href)= name .collapse.navbar-collapse( id=id ) ul.nav.navbar-nav block -mixin navbar-static(name,id,style) +mixin navbar-static(name,id,style,href) - var style = (typeof style === 'undefined') ? "default" : style nav( role="navigation", class=["navbar","navbar-static-top","navbar-" + style] ) .container @@ -60,7 +64,7 @@ mixin navbar-static(name,id,style) span.icon-bar span.icon-bar span.icon-bar - a.navbar-brand(href='#')= name + a.navbar-brand(href=href)= name .collapse.navbar-collapse( id=id ) ul.nav.navbar-nav block diff --git a/test/fixtures/navbars/nav-divider.pug b/test/fixtures/navbars/nav-divider.pug new file mode 100644 index 0000000..ab8df69 --- /dev/null +++ b/test/fixtures/navbars/nav-divider.pug @@ -0,0 +1,2 @@ +include ../../../components/navbar.pug ++nav_divider \ No newline at end of file diff --git a/test/fixtures/navbars/nav-header.pug b/test/fixtures/navbars/nav-header.pug new file mode 100644 index 0000000..0d864f5 --- /dev/null +++ b/test/fixtures/navbars/nav-header.pug @@ -0,0 +1,2 @@ +include ../../../components/navbar.pug ++nav_header Test Header \ No newline at end of file diff --git a/test/fixtures/navbars/nav-item-dropdown.pug b/test/fixtures/navbars/nav-item-dropdown.pug new file mode 100644 index 0000000..4af1eb9 --- /dev/null +++ b/test/fixtures/navbars/nav-item-dropdown.pug @@ -0,0 +1,2 @@ +include ../../../components/navbar.pug ++nav_item_dropdown(href, active) \ No newline at end of file diff --git a/test/fixtures/navbars/navbar-fixed.pug b/test/fixtures/navbars/navbar-fixed.pug new file mode 100644 index 0000000..d3a5cbc --- /dev/null +++ b/test/fixtures/navbars/navbar-fixed.pug @@ -0,0 +1,2 @@ +include ../../../components/navbar.pug ++navbar-fixed(name, id, style, href) \ No newline at end of file diff --git a/test/fixtures/navbars/navbar-item.pug b/test/fixtures/navbars/navbar-item.pug new file mode 100644 index 0000000..0fc0166 --- /dev/null +++ b/test/fixtures/navbars/navbar-item.pug @@ -0,0 +1,2 @@ +include ../../../components/navbar.pug ++nav_item(href, active) Test \ No newline at end of file diff --git a/test/fixtures/navbars/navbar-static.pug b/test/fixtures/navbars/navbar-static.pug new file mode 100644 index 0000000..636953b --- /dev/null +++ b/test/fixtures/navbars/navbar-static.pug @@ -0,0 +1,2 @@ +include ../../../components/navbar.pug ++navbar-static(name, id, style, href) \ No newline at end of file diff --git a/test/fixtures/navbars/navbar.pug b/test/fixtures/navbars/navbar.pug new file mode 100644 index 0000000..75067c9 --- /dev/null +++ b/test/fixtures/navbars/navbar.pug @@ -0,0 +1,2 @@ +include ../../../components/navbar.pug ++navbar(name, id, style, href) \ No newline at end of file diff --git a/test/navbars.js b/test/navbars.js new file mode 100644 index 0000000..cc3078a --- /dev/null +++ b/test/navbars.js @@ -0,0 +1,77 @@ +var assert = require("assert"); +var jade = require("pug"); +var fs = require("fs"); +var path = require("path"); + +describe("Navbars", function () { + it('should generate a navbar', function () { + var locals = { + name: 'navbar-name', + id: 'navbar-id', + style: 'style', + href: 'href' + }; + var fn = jade.compileFile(path.join(__dirname, "fixtures/navbars", "navbar.pug")); + assert.equal('', fn(locals)); + }); + it('should generate a static navbar', function () { + var locals = { + name: 'navbar-name', + id: 'navbar-id', + style: 'style', + href: 'href' + }; + var fn = jade.compileFile(path.join(__dirname, "fixtures/navbars", "navbar-static.pug")); + assert.equal('', fn(locals)); + }); + it('should generate a fixed navbar', function () { + var locals = { + name: 'navbar-name', + id: 'navbar-id', + style: 'style', + href: 'href' + }; + var fn = jade.compileFile(path.join(__dirname, "fixtures/navbars", "navbar-fixed.pug")); + assert.equal('', fn(locals)); + }); + it('should generate a navbar item', function () { + var locals = { + href: 'href' + }; + var fn = jade.compileFile(path.join(__dirname, "fixtures/navbars", "navbar-item.pug")); + assert.equal('
  • Test
  • ', fn(locals)); + }); + it('should generate an active navbar item', function () { + var locals = { + href: 'href', + active: true + }; + var fn = jade.compileFile(path.join(__dirname, "fixtures/navbars", "navbar-item.pug")); + assert.equal('
  • Test
  • ', fn(locals)); + }); + it('should generate a navbar divider', function () { + var locals = {}; + var fn = jade.compileFile(path.join(__dirname, "fixtures/navbars", "nav-divider.pug")); + assert.equal('
  • ', fn(locals)); + }); + it('should generate a navbar dropdown', function () { + var locals = { + href: 'href' + }; + var fn = jade.compileFile(path.join(__dirname, "fixtures/navbars", "nav-item-dropdown.pug")); + assert.equal('', fn(locals)); + }); + it('should generate an active navbar dropdown', function () { + var locals = { + href: 'href', + active: true + }; + var fn = jade.compileFile(path.join(__dirname, "fixtures/navbars", "nav-item-dropdown.pug")); + assert.equal('', fn(locals)); + }); + it('should generate a navbar header', function () { + var locals = {}; + var fn = jade.compileFile(path.join(__dirname, "fixtures/navbars", "nav-header.pug")); + assert.equal('', fn(locals)); + }); +}); \ No newline at end of file From 54e4e0f6a2139d269e863db37f1cccfd5c95df34 Mon Sep 17 00:00:00 2001 From: mike-goodwin Date: Tue, 29 Nov 2016 20:18:25 +0000 Subject: [PATCH 5/6] bumped bower.json version --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 7425e94..491ea65 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pug-bootstrap", - "version": "0.0.1", + "version": "0.0.5", "homepage": "https://github.com/mike-goodwin/pug-bootstrap", "authors": [ "mike.goodwin@owasp.org" From 277b2664648aaca6c4519a1a39ab9bcd53e1dcd7 Mon Sep 17 00:00:00 2001 From: mike-goodwin Date: Tue, 29 Nov 2016 20:18:40 +0000 Subject: [PATCH 6/6] 0.0.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 855edc2..f3e3414 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pug-bootstrap", - "version": "0.0.4", + "version": "0.0.5", "description": "Bootstrap framework written completely using mixins in pug", "main": "bootstrap.pug", "scripts": {