18 |
19 |
- Lorem, ipsum dolor.
20 | - Lorem ipsum dolor sit amet, consectetur adipisicing elit. Optio sed incidunt dolorum fugit alias nesciunt architecto aliquid pariatur beatae consequatur.
21 |
22 |
23 |
- Ex, eum veniam.
24 | - Sapiente est deleniti ducimus sequi aspernatur. Magni, iste asperiores ducimus accusantium labore inventore optio, nulla consequuntur repellat sed ipsa. Expedita?
25 |
26 |
27 |
- Ipsam, laudantium sint.
28 | - Facere dolor minima incidunt quo mollitia beatae praesentium hic similique, nam odit excepturi repudiandae dolorum earum, aliquam veritatis perferendis nobis.
29 |
30 |
31 |
- Aut, eos cum.
32 | - Dolorum, laborum repellat, quis eveniet officia quisquam hic, consequuntur error voluptatem fuga voluptates nulla ullam cupiditate necessitatibus atque obcaecati rerum?
33 |
34 |
35 |
- Quas, vitae quam!
36 | - Quas unde veniam eius saepe tempora placeat recusandae dolorum corporis aspernatur quam, impedit aliquam, cumque deleniti assumenda voluptas quae officia?
37 |
38 |
39 |
--------------------------------------------------------------------------------
/test/project/src/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Pangolin.js
3 | ---
4 |
5 | Let's have a look at the Fractal design system framework.
6 |
7 | ## Include a component
8 |
9 | And this is a button thingy:
10 |
11 | ```jinja
12 | {% view '@button' %}
13 | ```
14 |
15 | …which renders to this default variant:
16 |
17 | ```html
18 | {% render '@button' %}
19 | ```
20 |
--------------------------------------------------------------------------------
/test/project/src/main.js:
--------------------------------------------------------------------------------
1 | import './components/button/button.js'
2 | import './components/media/image.js'
3 |
--------------------------------------------------------------------------------
/test/project/src/main.scss:
--------------------------------------------------------------------------------
1 | @use "setup/variables.scss";
2 | @use "setup/fonts.scss";
3 | @use "setup/scaffolding.scss";
4 |
5 | @use "components/button/button.scss";
6 | @use "components/media/image.scss";
7 |
--------------------------------------------------------------------------------
/test/project/src/setup/JetBrainsMono-Regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pangolinjs/core/e4d157cc1a476e845c4e87a1f452831e119b0289/test/project/src/setup/JetBrainsMono-Regular.woff
--------------------------------------------------------------------------------
/test/project/src/setup/JetBrainsMono-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pangolinjs/core/e4d157cc1a476e845c4e87a1f452831e119b0289/test/project/src/setup/JetBrainsMono-Regular.woff2
--------------------------------------------------------------------------------
/test/project/src/setup/fonts.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: "JetBrains Mono";
3 | src:
4 | url("JetBrainsMono-Regular.woff2") format("woff2"),
5 | url("JetBrainsMono-Regular.woff") format("woff");
6 | }
7 |
--------------------------------------------------------------------------------
/test/project/src/setup/scaffolding.scss:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: "JetBrains Mono", monospace;
3 | }
4 |
--------------------------------------------------------------------------------
/test/project/src/setup/variables.scss:
--------------------------------------------------------------------------------
1 | :root {
2 | --darkgreen: hsl(120deg 100% 20%);
3 | --lightgreen: hsl(120deg 73% 75%);
4 | }
5 |
--------------------------------------------------------------------------------
/test/unit/lib/copy-dir.spec.js:
--------------------------------------------------------------------------------
1 | import fs from 'fs/promises'
2 | import path from 'path'
3 | import test from 'ava'
4 |
5 | import copyDir from '../../../lib/copy-dir.js'
6 | import getDirname from '../../../lib/get-dirname.js'
7 |
8 | test('copies entire directory', async t => {
9 | const dirname = getDirname(import.meta.url)
10 | const source = path.join(dirname, 'helpers')
11 | const destination = path.join(dirname, '.helpers-temp')
12 |
13 | await fs.mkdir(destination)
14 | await copyDir(source, destination)
15 | const result = await fs.readdir(destination)
16 | t.snapshot(result)
17 | await fs.rm(destination, { recursive: true, force: true })
18 | })
19 |
--------------------------------------------------------------------------------
/test/unit/lib/format-ip.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import formatIP from '../../../lib/format-ip.js'
4 |
5 | test('formats localhost IPv4', t => {
6 | const result = formatIP('0.0.0.0')
7 | t.is(result, 'localhost')
8 | })
9 |
10 | test('formats localhost IPv6', t => {
11 | const result = formatIP('::')
12 | t.is(result, 'localhost')
13 | })
14 |
15 | test('returns non-localhost IP', t => {
16 | const result = formatIP('10.0.0.0')
17 | t.is(result, '10.0.0.0')
18 | })
19 |
--------------------------------------------------------------------------------
/test/unit/lib/generate-asset-filename.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import generateAssetFilename from '../../../lib/generate-asset-filename.js'
4 |
5 | test('generates options', t => {
6 | const result = generateAssetFilename({ type: 'img' })
7 | t.snapshot(result)
8 | })
9 |
10 | test('generates options with hash', t => {
11 | const result = generateAssetFilename({ type: 'img', hash: true })
12 | t.snapshot(result)
13 | })
14 |
--------------------------------------------------------------------------------
/test/unit/lib/generate-output-filename.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import generateOutputFilename from '../../../lib/generate-output-filename.js'
4 |
5 | test('generates output filename', t => {
6 | const result = generateOutputFilename({ type: 'js' })
7 | t.is(result, 'js/[name].js')
8 | })
9 |
10 | test('generates output filename with hash', t => {
11 | const result = generateOutputFilename({ type: 'js', hash: 'all' })
12 | t.is(result, 'js/[contenthash:8].js')
13 | })
14 |
--------------------------------------------------------------------------------
/test/unit/lib/get-asset-files.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import getAssetFiles from '../../../lib/get-asset-files.js'
4 |
5 | test('gets asset files', t => {
6 | const result = getAssetFiles({
7 | files: ['hello.js', 'world.css', 'universe.svg']
8 | })
9 |
10 | t.snapshot(result)
11 | })
12 |
--------------------------------------------------------------------------------
/test/unit/lib/get-config.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import getConfig from '../../../lib/get-config.js'
4 | import getDirname from '../../../lib/get-dirname.js'
5 |
6 | test.serial('gets default config', async t => {
7 | const result = await getConfig({})
8 | t.snapshot(result)
9 | })
10 |
11 | test.serial('gets user config', async t => {
12 | const dirname = getDirname(import.meta.url)
13 | const result = await getConfig({ context: dirname + '/helpers' })
14 | t.snapshot(result)
15 | })
16 |
--------------------------------------------------------------------------------
/test/unit/lib/get-dirname.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import getDirname from '../../../lib/get-dirname.js'
4 |
5 | test('gets current file’s dirname', t => {
6 | const result = getDirname(import.meta.url)
7 | t.true(result.endsWith('/test/unit/lib'))
8 | })
9 |
--------------------------------------------------------------------------------
/test/unit/lib/get-host-ips.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import getHostIPs from '../../../lib/get-host-ips.js'
4 |
5 | test('gets host IPs', t => {
6 | const result = getHostIPs()
7 |
8 | for (const ip of result) {
9 | t.true(typeof ip === 'string')
10 | }
11 | })
12 |
--------------------------------------------------------------------------------
/test/unit/lib/get-path.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import getPaths from '../../../lib/get-paths.js'
4 |
5 | test('gets paths', t => {
6 | const result = getPaths({ context: 'test' })
7 | t.snapshot(result)
8 | })
9 |
--------------------------------------------------------------------------------
/test/unit/lib/get-pkg.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import getDirname from '../../../lib/get-dirname.js'
4 | import getPkg from '../../../lib/get-pkg.js'
5 |
6 | test('gets package.json', async t => {
7 | const dirname = getDirname(import.meta.url)
8 | const result = await getPkg({ context: dirname + '/helpers' })
9 | t.snapshot(result)
10 | })
11 |
--------------------------------------------------------------------------------
/test/unit/lib/get-port.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import getPort from '../../../lib/get-port.js'
4 |
5 | test('gets unused port', async t => {
6 | const result = await getPort(1337)
7 | t.is(result, 1337)
8 | })
9 |
--------------------------------------------------------------------------------
/test/unit/lib/helpers/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test",
3 | "version": "1.0.0",
4 | "author": {
5 | "name": "Test Author"
6 | },
7 | "type": "module"
8 | }
9 |
--------------------------------------------------------------------------------
/test/unit/lib/helpers/pangolin.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | ui: {
3 | color: 'teal'
4 | },
5 |
6 | hashFiles: 'all'
7 | }
8 |
--------------------------------------------------------------------------------
/test/unit/lib/is-data-type.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import isDataType from '../../../lib/is-data-type.js'
4 |
5 | test('detects objects', t => {
6 | const result = isDataType({}, Object)
7 | t.true(result)
8 | })
9 |
10 | test('detects arrays', t => {
11 | const result = isDataType([], Array)
12 | t.true(result)
13 | })
14 |
15 | test('detects dates', t => {
16 | const result = isDataType(new Date(), Date)
17 | t.true(result)
18 | })
19 |
20 | test('detects functions', t => {
21 | const result = isDataType(() => {}, Function)
22 | t.true(result)
23 | })
24 |
25 | test('detects strings', t => {
26 | const result = isDataType('', String)
27 | t.true(result)
28 | })
29 |
30 | test('detects numbers', t => {
31 | const result = isDataType(0, Number)
32 | t.true(result)
33 | })
34 |
35 | test('detects booleans', t => {
36 | const result = isDataType(true, Boolean)
37 | t.true(result)
38 | })
39 |
40 | test('detects symbols', t => {
41 | const result = isDataType(Symbol(''), Symbol)
42 | t.true(result)
43 | })
44 |
--------------------------------------------------------------------------------
/test/unit/lib/merge-objects.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import mergeObjects from '../../../lib/merge-objects.js'
4 |
5 | test('shallow merges', t => {
6 | const target = {
7 | hello: 'world'
8 | }
9 |
10 | const source = {
11 | hello: 'galaxy',
12 | foo: 'bar'
13 | }
14 |
15 | const result = mergeObjects(target, source)
16 | t.snapshot(result)
17 | })
18 |
19 | test('deep merges', t => {
20 | const target = {
21 | species: {
22 | me: 'Human',
23 | you: 'Wookie'
24 | }
25 | }
26 |
27 | const source = {
28 | species: {
29 | you: 'Togruta'
30 | }
31 | }
32 |
33 | const result = mergeObjects(target, source)
34 | t.snapshot(result)
35 | })
36 |
--------------------------------------------------------------------------------
/test/unit/lib/pangolin-head-extension.spec.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | import PangolinHeadExtension from '../../../lib/pangolin-head-extension.js'
4 |
5 | test.serial('creates markup in dev mode', t => {
6 | const nodeEnvCopy = process.env.NODE_ENV
7 | process.env.NODE_ENV = 'development'
8 |
9 | const publicPath = '/hello/world/'
10 | const assets = { js: [], css: [] }
11 |
12 | const result = new PangolinHeadExtension({ publicPath, assets })
13 | t.snapshot(result.run().val)
14 |
15 | process.env.NODE_ENV = nodeEnvCopy
16 | })
17 |
18 | test.serial('creates markup in prod mode', t => {
19 | const publicPath = '/hello/world/'
20 | const assets = {
21 | js: ['vendor.js', 'app.js'],
22 | css: ['vendor.css', 'app.css']
23 | }
24 |
25 | const result = new PangolinHeadExtension({ publicPath, assets })
26 |
27 | t.deepEqual(result.tags, ['pangolin_head'])
28 | t.snapshot(result.run().val)
29 | })
30 |
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/copy-dir.spec.js.md:
--------------------------------------------------------------------------------
1 | # Snapshot report for `test/unit/lib/copy-dir.spec.js`
2 |
3 | The actual snapshot is saved in `copy-dir.spec.js.snap`.
4 |
5 | Generated by [AVA](https://avajs.dev).
6 |
7 | ## copies entire directory
8 |
9 | > Snapshot 1
10 |
11 | [
12 | 'package.json',
13 | 'pangolin.config.js',
14 | ]
15 |
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/copy-dir.spec.js.snap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pangolinjs/core/e4d157cc1a476e845c4e87a1f452831e119b0289/test/unit/lib/snapshots/copy-dir.spec.js.snap
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/generate-asset-filename.spec.js.md:
--------------------------------------------------------------------------------
1 | # Snapshot report for `test/unit/lib/generate-asset-filename.spec.js`
2 |
3 | The actual snapshot is saved in `generate-asset-filename.spec.js.snap`.
4 |
5 | Generated by [AVA](https://avajs.dev).
6 |
7 | ## generates options
8 |
9 | > Snapshot 1
10 |
11 | 'img/[name][ext]'
12 |
13 | ## generates options with hash
14 |
15 | > Snapshot 1
16 |
17 | 'img/[contenthash:8][ext]'
18 |
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/generate-asset-filename.spec.js.snap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pangolinjs/core/e4d157cc1a476e845c4e87a1f452831e119b0289/test/unit/lib/snapshots/generate-asset-filename.spec.js.snap
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/get-asset-files.spec.js.md:
--------------------------------------------------------------------------------
1 | # Snapshot report for `test/unit/lib/get-asset-files.spec.js`
2 |
3 | The actual snapshot is saved in `get-asset-files.spec.js.snap`.
4 |
5 | Generated by [AVA](https://avajs.dev).
6 |
7 | ## gets asset files
8 |
9 | > Snapshot 1
10 |
11 | {
12 | css: [
13 | 'world.css',
14 | ],
15 | js: [
16 | 'hello.js',
17 | ],
18 | }
19 |
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/get-asset-files.spec.js.snap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pangolinjs/core/e4d157cc1a476e845c4e87a1f452831e119b0289/test/unit/lib/snapshots/get-asset-files.spec.js.snap
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/get-config.spec.js.md:
--------------------------------------------------------------------------------
1 | # Snapshot report for `test/unit/lib/get-config.spec.js`
2 |
3 | The actual snapshot is saved in `get-config.spec.js.snap`.
4 |
5 | Generated by [AVA](https://avajs.dev).
6 |
7 | ## gets default config
8 |
9 | > Snapshot 1
10 |
11 | {
12 | hashFiles: 'imported',
13 | project: {
14 | author: null,
15 | base: '/assets/',
16 | name: 'Pangolin.js',
17 | version: null,
18 | },
19 | ui: {
20 | color: {
21 | accent: '#ff721f',
22 | complement: '#000',
23 | links: '#7f390f',
24 | },
25 | favicon: '/favicon.ico',
26 | format: 'json',
27 | information: [
28 | {
29 | label: 'Version',
30 | value: null,
31 | },
32 | {
33 | format: Function format {},
34 | label: 'Built on',
35 | type: 'time',
36 | value: Date 2000-01-01 00:00:00 UTC {},
37 | },
38 | ],
39 | labels: {
40 | panels: {
41 | html: 'Render',
42 | view: 'Source',
43 | },
44 | },
45 | lang: 'en',
46 | },
47 | }
48 |
49 | ## gets user config
50 |
51 | > Snapshot 1
52 |
53 | {
54 | hashFiles: 'all',
55 | project: {
56 | author: 'Test Author',
57 | base: '/assets/',
58 | name: 'test',
59 | version: '1.0.0',
60 | },
61 | ui: {
62 | color: 'teal',
63 | favicon: '/favicon.ico',
64 | format: 'json',
65 | information: [
66 | {
67 | label: 'Version',
68 | value: '1.0.0',
69 | },
70 | {
71 | format: Function format {},
72 | label: 'Built on',
73 | type: 'time',
74 | value: Date 2000-01-01 00:00:00 UTC {},
75 | },
76 | ],
77 | labels: {
78 | panels: {
79 | html: 'Render',
80 | view: 'Source',
81 | },
82 | },
83 | lang: 'en',
84 | },
85 | }
86 |
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/get-config.spec.js.snap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pangolinjs/core/e4d157cc1a476e845c4e87a1f452831e119b0289/test/unit/lib/snapshots/get-config.spec.js.snap
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/get-path.spec.js.md:
--------------------------------------------------------------------------------
1 | # Snapshot report for `test/unit/lib/get-path.spec.js`
2 |
3 | The actual snapshot is saved in `get-path.spec.js.snap`.
4 |
5 | Generated by [AVA](https://avajs.dev).
6 |
7 | ## gets paths
8 |
9 | > Snapshot 1
10 |
11 | {
12 | inputComponents: 'test/src/components',
13 | inputDocs: 'test/src/docs',
14 | inputPublic: 'test/public',
15 | outputAssets: 'test/public/assets',
16 | outputBuild: 'test/dist',
17 | outputStatic: 'test/static',
18 | }
19 |
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/get-path.spec.js.snap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pangolinjs/core/e4d157cc1a476e845c4e87a1f452831e119b0289/test/unit/lib/snapshots/get-path.spec.js.snap
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/get-pkg.spec.js.md:
--------------------------------------------------------------------------------
1 | # Snapshot report for `test/unit/lib/get-pkg.spec.js`
2 |
3 | The actual snapshot is saved in `get-pkg.spec.js.snap`.
4 |
5 | Generated by [AVA](https://avajs.dev).
6 |
7 | ## gets package.json
8 |
9 | > Snapshot 1
10 |
11 | {
12 | author: {
13 | name: 'Test Author',
14 | },
15 | name: 'test',
16 | type: 'module',
17 | version: '1.0.0',
18 | }
19 |
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/get-pkg.spec.js.snap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pangolinjs/core/e4d157cc1a476e845c4e87a1f452831e119b0289/test/unit/lib/snapshots/get-pkg.spec.js.snap
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/merge-objects.spec.js.md:
--------------------------------------------------------------------------------
1 | # Snapshot report for `test/unit/lib/merge-objects.spec.js`
2 |
3 | The actual snapshot is saved in `merge-objects.spec.js.snap`.
4 |
5 | Generated by [AVA](https://avajs.dev).
6 |
7 | ## shallow merges
8 |
9 | > Snapshot 1
10 |
11 | {
12 | foo: 'bar',
13 | hello: 'galaxy',
14 | }
15 |
16 | ## deep merges
17 |
18 | > Snapshot 1
19 |
20 | {
21 | species: {
22 | me: 'Human',
23 | you: 'Togruta',
24 | },
25 | }
26 |
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/merge-objects.spec.js.snap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pangolinjs/core/e4d157cc1a476e845c4e87a1f452831e119b0289/test/unit/lib/snapshots/merge-objects.spec.js.snap
--------------------------------------------------------------------------------
/test/unit/lib/snapshots/pangolin-head-extension.spec.js.md:
--------------------------------------------------------------------------------
1 | # Snapshot report for `test/unit/lib/pangolin-head-extension.spec.js`
2 |
3 | The actual snapshot is saved in `pangolin-head-extension.spec.js.snap`.
4 |
5 | Generated by [AVA](https://avajs.dev).
6 |
7 | ## creates markup in dev mode
8 |
9 | > Snapshot 1
10 |
11 | ''
12 |
13 | ## creates markup in prod mode
14 |
15 | > Snapshot 1
16 |
17 | `␊
18 | ␊
19 |