This repository has been archived by the owner on Apr 16, 2021. It is now read-only.
forked from jsdelivr/bootstrapcdn
-
Notifications
You must be signed in to change notification settings - Fork 1
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
11 changed files
with
142 additions
and
5 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 |
---|---|---|
|
@@ -14,9 +14,7 @@ | |
"requireSpecificAttributes": [ | ||
{ | ||
"img": [ | ||
"alt", | ||
"width", | ||
"height" | ||
"alt" | ||
] | ||
} | ||
], | ||
|
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
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,18 @@ | ||
'use strict'; | ||
|
||
const express = require('express'); | ||
const appendLocals = require('./appendLocals.js'); | ||
|
||
const router = express.Router(); | ||
|
||
router.get('/', (req, res) => { | ||
res = appendLocals(req, res); | ||
res.render('books.pug', { | ||
title: 'Bootstrap Books', | ||
description: 'Books that feature BootstrapCDN.' | ||
}); | ||
}); | ||
|
||
module.exports = router; | ||
|
||
// vim: ft=javascript sw=4 sts=4 et: |
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,65 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert').strict; | ||
const htmlEncode = require('htmlencode').htmlEncode; | ||
const helpers = require('./test_helpers.js'); | ||
|
||
describe('books', () => { | ||
const config = helpers.getConfig(); | ||
const uri = helpers.getURI('books'); | ||
let response = {}; | ||
|
||
before((done) => { | ||
helpers.prefetch(uri, (res) => { | ||
response = res; | ||
done(); | ||
}); | ||
}); | ||
|
||
it('works', (done) => { | ||
helpers.assert.itWorks(response.statusCode, done); | ||
}); | ||
|
||
it('valid html', (done) => { | ||
helpers.assert.validHTML(response, done); | ||
}); | ||
|
||
it('contains authors', (done) => { | ||
helpers.assert.authors(response, done); | ||
}); | ||
|
||
it('has page header', (done) => { | ||
helpers.assert.pageHeader('Books', response, done); | ||
}); | ||
|
||
config.books.forEach((book) => { | ||
describe(book.name, () => { | ||
const beforeTrackImgUrl = `https://ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=${book.asin}&Format=_SL250_&ID=AsinImage&MarketPlace=US&ServiceVersion=20070822&WS=1&tag=bcdn-20`; | ||
const afterTrackImgUrl = `https://ir-na.amazon-adsystem.com/e/ir?t=bcdn-20&l=li3&o=1&a=${book.asin}`; | ||
|
||
it('has name', (done) => { | ||
assert.ok(response.body.includes(book.name), | ||
`Expects response body to include "${book.name}"`); | ||
done(); | ||
}); | ||
|
||
it('has url', (done) => { | ||
assert.ok(response.body.includes(htmlEncode(book.url)), | ||
`Expects response body to include "${book.url}"`); | ||
done(); | ||
}); | ||
|
||
it('has before tracking image', (done) => { | ||
assert.ok(response.body.includes(htmlEncode(beforeTrackImgUrl)), | ||
`Expects response body to include "${beforeTrackImgUrl}"`); | ||
done(); | ||
}); | ||
|
||
it('has after tracking image', (done) => { | ||
assert.ok(response.body.includes(htmlEncode(afterTrackImgUrl)), | ||
`Expects response body to include "${afterTrackImgUrl}"`); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
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,16 @@ | ||
- | ||
const beforeTrackImgUrl = `https://ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=${book.asin}&Format=_SL250_&ID=AsinImage&MarketPlace=US&ServiceVersion=20070822&WS=1&tag=bcdn-20`; | ||
const afterTrackImgUrl = `https://ir-na.amazon-adsystem.com/e/ir?t=bcdn-20&l=li3&o=1&a=${book.asin}`; | ||
.card-deck | ||
.card.border-primary.py-3.px-md-3.mb-3.text-center | ||
.card-header.bg-transparent.border-0 | ||
h3.h4.card-title.mb-0=book.name | ||
.card-body.bg-transparent.border-0 | ||
a(href=book.url, rel='noopener', target='_blank') | ||
img.border-0(src=beforeTrackImgUrl, alt='') | ||
img.border-0.m-0(src=afterTrackImgUrl, width='1', height='1', alt='') | ||
.card-footer.bg-transparent.border-0 | ||
a.btn.btn-primary.btn-lg.btn-block.w-75.mx-auto.py-3(href=book.url, rel='noopener', target='_blank') Buy from Amazon | ||
|
||
//- vim: ft=pug sw=4 sts=4 et: |
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,19 @@ | ||
extends layout.pug | ||
|
||
block content | ||
h2.text-center.mb-4 Books | ||
|
||
.row | ||
each book in config.books | ||
.col-12.col-md-6 | ||
include _partials/books.pug | ||
|
||
.row | ||
.col-12 | ||
.alert.alert-primary.my-3.text-center(role='alert') | ||
p.m-0 | ||
| You want to submit yours? Open a Pull Request or an Issue on our | ||
a.alert-link(href='https://github.com/MaxCDN/bootstrapcdn') GitHub repository | ||
| . | ||
|
||
//- vim: ft=pug sw=4 sts=4 et: |