Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
223 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"template": "404.jade" | ||
} |
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,27 @@ | ||
|
||
extends layout | ||
|
||
block append title | ||
| » Page non trouvée | ||
|
||
block content | ||
!= page.html | ||
- var archive = _.chain(contents.articles._.directories).map(function(item) { | ||
- return item.index | ||
- }).compact().filter(function(article) { | ||
- return article.metadata.ignored !== true | ||
- }).sortBy(function(item) { | ||
- return -item.date | ||
- }).groupBy(function(item) { | ||
- return item.date.getFullYear() | ||
- }).value() | ||
- var map = _.chain(Date.CultureInfo.monthNames).map(function(item) { | ||
- return item[0].toUpperCase() + item.substring(1) | ||
- }).value() | ||
|
||
section#page | ||
.page-header | ||
h1 Page non trouvée | ||
.hero-unit | ||
h2 404 | ||
p A work in progress |
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,193 @@ | ||
vows = require 'vows' | ||
assert = require 'assert' | ||
phantom = require 'phantom' | ||
sys = require 'sys' | ||
|
||
describe = (name, bat) -> vows.describe(name).addBatch(bat).export(module) | ||
|
||
# Make coffeescript not return anything | ||
# This is needed because vows topics do different things if you have a return value | ||
t = (fn) -> | ||
(args...) -> | ||
fn.apply this, args | ||
return | ||
|
||
describe "Page 404" | ||
"A page": | ||
topic: t -> | ||
test = this | ||
phantom.create (p) -> | ||
p.createPage (page) -> | ||
test.callback null, page, p | ||
|
||
"can open a URL on localhost": | ||
topic: t (page) -> | ||
page.open "http://127.0.0.1:10113/404.html", (status) => | ||
page.includeJs "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" | ||
@callback null, page, status | ||
|
||
"and succeed": (err, page, status) -> | ||
assert.equal status, "success" | ||
|
||
"and the page, once it loads,": | ||
topic: t (page) -> | ||
setTimeout => | ||
@callback null, page | ||
, 1000 | ||
|
||
"has a title": | ||
topic: t (page) -> | ||
page.evaluate (-> document.title), (title) => @callback null, title | ||
|
||
"which is correct": (title) -> | ||
assert.equal title, "Le blog d'Olivier » Page non trouvée" | ||
|
||
"has page title": | ||
topic: t (page) -> | ||
page.evaluate (-> $("h1").text()), (title) => @callback null, title | ||
|
||
"which is correct": (title) -> | ||
assert.equal title, "Page non trouvée" | ||
|
||
"has navbar": | ||
topic: t (page) -> | ||
page.evaluate (-> $(".navbar.navbar-fixed-top").length), (navbar) => @callback null, navbar | ||
|
||
"which is no empty": (navbar) -> | ||
assert.equal navbar, 1 | ||
|
||
"has navbar title": | ||
topic: t (page) -> | ||
page.evaluate (-> $(".navbar.navbar-fixed-top a.brand").text()), (title) => @callback null, title | ||
|
||
"which is correct": (title) -> | ||
assert.equal title, "Le blog d'Olivier" | ||
|
||
"has footer": | ||
topic: t (page) -> | ||
page.evaluate (-> $("footer").length), (footer) => @callback null, footer | ||
|
||
"which is no empty": (footer) -> | ||
assert.equal footer, 1 | ||
|
||
"has tags section": | ||
topic: t (page) -> | ||
page.evaluate (-> $("#tags").length), (tags) => @callback null, tags | ||
|
||
"which is no empty": (tags) -> | ||
assert.equal tags, 1 | ||
|
||
"has tags": | ||
topic: t (page) -> | ||
page.evaluate (-> $("#tags a").length), (tags) => @callback null, tags | ||
|
||
"which is no empty": (tags) -> | ||
assert.isTrue tags > 50 | ||
|
||
"has archives section": | ||
topic: t (page) -> | ||
page.evaluate (-> $("#archives").length), (archives) => @callback null, archives | ||
|
||
"which is no empty": (archives) -> | ||
assert.equal archives, 1 | ||
|
||
"has archives": | ||
topic: t (page) -> | ||
page.evaluate (-> $("#archives a").length), (archives) => @callback null, archives | ||
|
||
"which is no empty": (archives) -> | ||
assert.equal archives, 7 | ||
|
||
teardown: (page, ph) -> | ||
ph.exit() | ||
|
||
|
||
describe "Page 404 Not Found" | ||
"A page": | ||
topic: t -> | ||
test = this | ||
phantom.create (p) -> | ||
p.createPage (page) -> | ||
test.callback null, page, p | ||
|
||
"can open a URL on localhost": | ||
topic: t (page) -> | ||
page.open "http://127.0.0.1:10113/wtf.html", (status) => | ||
page.includeJs "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" | ||
@callback null, page, status | ||
|
||
"and succeed": (err, page, status) -> | ||
assert.equal status, "success" | ||
|
||
"and the page, once it loads,": | ||
topic: t (page) -> | ||
setTimeout => | ||
@callback null, page | ||
, 1000 | ||
|
||
"has a title": | ||
topic: t (page) -> | ||
page.evaluate (-> document.title), (title) => @callback null, title | ||
|
||
"which is correct": (title) -> | ||
assert.equal title, "Le blog d'Olivier » Page non trouvée" | ||
|
||
"has page title": | ||
topic: t (page) -> | ||
page.evaluate (-> $("h1").text()), (title) => @callback null, title | ||
|
||
"which is correct": (title) -> | ||
assert.equal title, "Page non trouvée" | ||
|
||
"has navbar": | ||
topic: t (page) -> | ||
page.evaluate (-> $(".navbar.navbar-fixed-top").length), (navbar) => @callback null, navbar | ||
|
||
"which is no empty": (navbar) -> | ||
assert.equal navbar, 1 | ||
|
||
"has navbar title": | ||
topic: t (page) -> | ||
page.evaluate (-> $(".navbar.navbar-fixed-top a.brand").text()), (title) => @callback null, title | ||
|
||
"which is correct": (title) -> | ||
assert.equal title, "Le blog d'Olivier" | ||
|
||
"has footer": | ||
topic: t (page) -> | ||
page.evaluate (-> $("footer").length), (footer) => @callback null, footer | ||
|
||
"which is no empty": (footer) -> | ||
assert.equal footer, 1 | ||
|
||
"has tags section": | ||
topic: t (page) -> | ||
page.evaluate (-> $("#tags").length), (tags) => @callback null, tags | ||
|
||
"which is no empty": (tags) -> | ||
assert.equal tags, 1 | ||
|
||
"has tags": | ||
topic: t (page) -> | ||
page.evaluate (-> $("#tags a").length), (tags) => @callback null, tags | ||
|
||
"which is no empty": (tags) -> | ||
assert.isTrue tags > 50 | ||
|
||
"has archives section": | ||
topic: t (page) -> | ||
page.evaluate (-> $("#archives").length), (archives) => @callback null, archives | ||
|
||
"which is no empty": (archives) -> | ||
assert.equal archives, 1 | ||
|
||
"has archives": | ||
topic: t (page) -> | ||
page.evaluate (-> $("#archives a").length), (archives) => @callback null, archives | ||
|
||
"which is no empty": (archives) -> | ||
assert.equal archives, 7 | ||
|
||
teardown: (page, ph) -> | ||
ph.exit() | ||
|