Skip to content

Commit

Permalink
Release v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
filiplikavcan committed Apr 12, 2019
1 parent 327d451 commit 18e08c5
Show file tree
Hide file tree
Showing 23 changed files with 324 additions and 807 deletions.
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "govuk-frontend",
"name": "navody-digital",
"scripts": {
},
"env": {
Expand Down
304 changes: 151 additions & 153 deletions app/__tests__/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ const expectedPages = [
'/examples/form-elements',
'/examples/grid',
'/examples/links',
'/examples/typography',
'/examples/template-default',
'/examples/template-custom'
'/examples/typography'
]

// Returns a wrapper for `request` which applies these options by default
Expand Down Expand Up @@ -59,160 +57,160 @@ describe(`http://localhost:${PORT}`, () => {
let componentsList = $('li a[href^="/components/"]').get()
// Since we have an 'all' component link that renders the default example of all
// components, there will always be one more expected link.
let expectedComponentLinks = lib.allComponents.length + 1
let expectedComponentLinks = lib.allComponents.length
expect(componentsList.length).toEqual(expectedComponentLinks)
done(err)
})
})
})

describe('/examples/template-custom', () => {
const templatePath = '/examples/template-custom'

it.each([
'headIcons',
'bodyStart',
'main',
'content',
'bodyEnd'
])('should have a %s block set', (block, done) => {
requestPath(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
expect($.html()).toContain(`<!-- block:${block} -->`)
done(err)
})
})

it('should have additional `htmlClasses`', done => {
requestPath(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $html = $('html')

expect($html.attr('class')).toBe('govuk-template app-html-class')
done(err)
})
})

it('should have assets overriden', done => {
requestPath(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $linkAsset = $('link[href^="/images/"]')
expect($linkAsset.length).toBe(6)
done(err)
})
})

it('should have theme-color overriden', done => {
requestPath(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $linkMaskIcon = $('link[rel="mask-icon"]')
const $metaThemeColor = $('meta[name="theme-color"]')

expect($linkMaskIcon.attr('color')).toBe('blue')
expect($metaThemeColor.attr('content')).toBe('blue')
done(err)
})
})

it('should have additional `bodyClasses`', done => {
requestPath(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $body = $('body')

expect($body.attr('class')).toBe('govuk-template__body app-body-class')
done(err)
})
})

it('should have `pageTitle` overriden', done => {
requestPath(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $title = $('title')

expect($title.html()).toBe('GOV.UK - Le meilleur endroit pour trouver des services gouvernementaux et de l&apos;information')
done(err)
})
})

it('should have an application stylesheet', done => {
requestPath(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $appStylesheet = $('link[href="/public/app.css"]')
expect($appStylesheet.length).toBe(1)
done(err)
})
})

it('should have a custom Skip link component', done => {
requestPath(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $skipLink = $('.govuk-skip-link')
expect($skipLink.html()).toBe('Passer au contenu principal')
done(err)
})
})

it('should have a custom Header component', done => {
requestPath(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $header = $('.govuk-header')
const $serviceName = $header.find('.govuk-header__link--service-name')
expect($serviceName.html()).toContain('Nom du service')
done(err)
})
})

it('should have a Phase banner component', done => {
requestPath.get(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $phaseBanner = $('.govuk-phase-banner')
const $text = $phaseBanner.find('.govuk-phase-banner__text')
expect($text.html()).toContain('C&apos;est un nouveau service - vos <a class="govuk-link" href="#">commentaires</a> nous aideront &#xE0; l&apos;am&#xE9;liorer.')
done(err)
})
})

it('should have a custom Footer component', done => {
requestPath.get(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $footer = $('.govuk-footer')
const $footerLink = $footer.find('.govuk-footer__link')
expect($footerLink.html()).toContain('Aidez-moi')
done(err)
})
})

it('should have `content` within the main section of the page', done => {
requestPath.get(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $main = $('main')

expect($main.html()).toContain('<!-- block:content -->')
done(err)
})
})

it('should have `beforeContent` outside the main section of the page', done => {
requestPath.get(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $container = $('.govuk-width-container')
const $phaseBanner = $container.find('> .govuk-phase-banner')
const $backLink = $container.find('> .govuk-back-link')

expect($phaseBanner.length).toBe(1)
expect($backLink.length).toBe(1)
done(err)
})
})

it('should have set `mainClasses`', done => {
requestPath.get(templatePath, (err, res) => {
let $ = cheerio.load(res.body)
const $main = $('main')

expect($main.attr('class')).toBe('govuk-main-wrapper app-main-class')
done(err)
})
})
})
// describe('/examples/template-custom', () => {
// const templatePath = '/examples/template-custom'
//
// it.each([
// 'headIcons',
// 'bodyStart',
// 'main',
// 'content',
// 'bodyEnd'
// ])('should have a %s block set', (block, done) => {
// requestPath(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// expect($.html()).toContain(`<!-- block:${block} -->`)
// done(err)
// })
// })
//
// it('should have additional `htmlClasses`', done => {
// requestPath(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $html = $('html')
//
// expect($html.attr('class')).toBe('govuk-template app-html-class')
// done(err)
// })
// })
//
// it('should have assets overriden', done => {
// requestPath(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $linkAsset = $('link[href^="/images/"]')
// expect($linkAsset.length).toBe(6)
// done(err)
// })
// })
//
// it('should have theme-color overriden', done => {
// requestPath(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $linkMaskIcon = $('link[rel="mask-icon"]')
// const $metaThemeColor = $('meta[name="theme-color"]')
//
// expect($linkMaskIcon.attr('color')).toBe('blue')
// expect($metaThemeColor.attr('content')).toBe('blue')
// done(err)
// })
// })
//
// it('should have additional `bodyClasses`', done => {
// requestPath(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $body = $('body')
//
// expect($body.attr('class')).toBe('govuk-template__body app-body-class')
// done(err)
// })
// })
//
// it('should have `pageTitle` overriden', done => {
// requestPath(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $title = $('title')
//
// expect($title.html()).toBe('GOV.UK - Le meilleur endroit pour trouver des services gouvernementaux et de l&apos;information')
// done(err)
// })
// })
//
// it('should have an application stylesheet', done => {
// requestPath(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $appStylesheet = $('link[href="/public/app.css"]')
// expect($appStylesheet.length).toBe(1)
// done(err)
// })
// })
//
// it('should have a custom Skip link component', done => {
// requestPath(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $skipLink = $('.govuk-skip-link')
// expect($skipLink.html()).toBe('Passer au contenu principal')
// done(err)
// })
// })
//
// it('should have a custom Header component', done => {
// requestPath(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $header = $('.govuk-header')
// const $serviceName = $header.find('.govuk-header__link--service-name')
// expect($serviceName.html()).toContain('Nom du service')
// done(err)
// })
// })
//
// it('should have a Phase banner component', done => {
// requestPath.get(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $phaseBanner = $('.govuk-phase-banner')
// const $text = $phaseBanner.find('.govuk-phase-banner__text')
// expect($text.html()).toContain('C&apos;est un nouveau service - vos <a class="govuk-link" href="#">commentaires</a> nous aideront &#xE0; l&apos;am&#xE9;liorer.')
// done(err)
// })
// })
//
// it('should have a custom Footer component', done => {
// requestPath.get(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $footer = $('.govuk-footer')
// const $footerLink = $footer.find('.govuk-footer__link')
// expect($footerLink.html()).toContain('Aidez-moi')
// done(err)
// })
// })
//
// it('should have `content` within the main section of the page', done => {
// requestPath.get(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $main = $('main')
//
// expect($main.html()).toContain('<!-- block:content -->')
// done(err)
// })
// })
//
// it('should have `beforeContent` outside the main section of the page', done => {
// requestPath.get(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $container = $('.govuk-width-container')
// const $phaseBanner = $container.find('> .govuk-phase-banner')
// const $backLink = $container.find('> .govuk-back-link')
//
// expect($phaseBanner.length).toBe(1)
// expect($backLink.length).toBe(1)
// done(err)
// })
// })
//
// it('should have set `mainClasses`', done => {
// requestPath.get(templatePath, (err, res) => {
// let $ = cheerio.load(res.body)
// const $main = $('main')
//
// expect($main.attr('class')).toBe('govuk-main-wrapper app-main-class')
// done(err)
// })
// })
// })
})
2 changes: 1 addition & 1 deletion dist/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.1
0.1.0
1 change: 0 additions & 1 deletion dist/govuk-frontend-2.5.1.min.js

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/navody-digital-0.1.0.min.js

Large diffs are not rendered by default.

File renamed without changes.
4 changes: 3 additions & 1 deletion lib/file-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const sdnChildDirectories = dir => {

// Generate component list from source directory, excluding anything that's not
// a directory (for example, .DS_Store files)
exports.allComponents = childDirectories(configPaths.components)
exports.allComponents = childDirectories(configPaths.components).filter(function (directory) {
return directory !== '_sdn' && directory !== '_custom'
})
exports.allSdnComponents = sdnChildDirectories(configPaths.sdn_components)

// Read the contents of a file from a given path
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"name": "govuk-frontend-repository",
"name": "navody-digital-repository",
"description": "Used only for the development of GOV.UK Frontend, see `package/package.json` for the published `package.json`",
"engines": {
"node": "8.9.4"
Expand Down
Loading

0 comments on commit 18e08c5

Please sign in to comment.