initial
This commit is contained in:
149
node_modules/pug-load/test/__snapshots__/index.test.js.snap
generated
vendored
Normal file
149
node_modules/pug-load/test/__snapshots__/index.test.js.snap
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
exports[`test pug-load 1`] = `
|
||||
Object {
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"line": 0,
|
||||
"nodes": Array [
|
||||
Object {
|
||||
"column": 1,
|
||||
"file": Object {
|
||||
"ast": Object {
|
||||
"filename": "<dirname>/bar.pug",
|
||||
"line": 0,
|
||||
"nodes": Array [
|
||||
Object {
|
||||
"column": 1,
|
||||
"filename": "<dirname>/bar.pug",
|
||||
"line": 1,
|
||||
"mode": "replace",
|
||||
"name": "bing",
|
||||
"nodes": Array [],
|
||||
"type": "NamedBlock",
|
||||
},
|
||||
],
|
||||
"type": "Block",
|
||||
},
|
||||
"column": 9,
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"fullPath": "<dirname>/bar.pug",
|
||||
"line": 1,
|
||||
"path": "bar.pug",
|
||||
"str": "block bing
|
||||
",
|
||||
"type": "FileReference",
|
||||
},
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"line": 1,
|
||||
"type": "Extends",
|
||||
},
|
||||
Object {
|
||||
"column": 1,
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"line": 3,
|
||||
"mode": "replace",
|
||||
"name": "bing",
|
||||
"nodes": Array [
|
||||
Object {
|
||||
"block": Object {
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"line": 4,
|
||||
"nodes": Array [],
|
||||
"type": "Block",
|
||||
},
|
||||
"column": 3,
|
||||
"file": Object {
|
||||
"ast": Object {
|
||||
"filename": "<dirname>/bing.pug",
|
||||
"line": 0,
|
||||
"nodes": Array [
|
||||
Object {
|
||||
"attributeBlocks": Array [],
|
||||
"attrs": Array [
|
||||
Object {
|
||||
"column": 1,
|
||||
"filename": "<basedir>/packages/pug-load/test/bing.pug",
|
||||
"line": 1,
|
||||
"mustEscape": false,
|
||||
"name": "class",
|
||||
"val": "\'bing\'",
|
||||
},
|
||||
],
|
||||
"block": Object {
|
||||
"filename": "<dirname>/bing.pug",
|
||||
"line": 1,
|
||||
"nodes": Array [
|
||||
Object {
|
||||
"column": 7,
|
||||
"filename": "<dirname>/bing.pug",
|
||||
"line": 1,
|
||||
"type": "Text",
|
||||
"val": "bong",
|
||||
},
|
||||
],
|
||||
"type": "Block",
|
||||
},
|
||||
"column": 1,
|
||||
"filename": "<dirname>/bing.pug",
|
||||
"isInline": false,
|
||||
"line": 1,
|
||||
"name": "div",
|
||||
"selfClosing": false,
|
||||
"type": "Tag",
|
||||
},
|
||||
],
|
||||
"type": "Block",
|
||||
},
|
||||
"column": 11,
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"fullPath": "<dirname>/bing.pug",
|
||||
"line": 4,
|
||||
"path": "bing.pug",
|
||||
"str": ".bing bong
|
||||
",
|
||||
"type": "FileReference",
|
||||
},
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"line": 4,
|
||||
"type": "Include",
|
||||
},
|
||||
Object {
|
||||
"attributeBlocks": Array [],
|
||||
"attrs": Array [],
|
||||
"block": Object {
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"line": 5,
|
||||
"nodes": Array [
|
||||
Object {
|
||||
"column": 5,
|
||||
"file": Object {
|
||||
"column": 13,
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"fullPath": "<dirname>/script.js",
|
||||
"line": 6,
|
||||
"path": "script.js",
|
||||
"str": "document.write(\'hello world!\');
|
||||
",
|
||||
"type": "FileReference",
|
||||
},
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"filters": Array [],
|
||||
"line": 6,
|
||||
"type": "RawInclude",
|
||||
},
|
||||
],
|
||||
"type": "Block",
|
||||
},
|
||||
"column": 3,
|
||||
"filename": "<dirname>/foo.pug",
|
||||
"isInline": false,
|
||||
"line": 5,
|
||||
"name": "script",
|
||||
"selfClosing": false,
|
||||
"type": "Tag",
|
||||
},
|
||||
],
|
||||
"type": "NamedBlock",
|
||||
},
|
||||
],
|
||||
"type": "Block",
|
||||
}
|
||||
`;
|
||||
1
node_modules/pug-load/test/bar.pug
generated
vendored
Normal file
1
node_modules/pug-load/test/bar.pug
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
block bing
|
||||
1
node_modules/pug-load/test/bing.pug
generated
vendored
Normal file
1
node_modules/pug-load/test/bing.pug
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.bing bong
|
||||
6
node_modules/pug-load/test/foo.pug
generated
vendored
Normal file
6
node_modules/pug-load/test/foo.pug
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
extends bar.pug
|
||||
|
||||
block bing
|
||||
include bing.pug
|
||||
script
|
||||
include script.js
|
||||
24
node_modules/pug-load/test/index.test.js
generated
vendored
Normal file
24
node_modules/pug-load/test/index.test.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var assert = require('assert');
|
||||
var walk = require('pug-walk');
|
||||
var lex = require('pug-lexer');
|
||||
var parse = require('pug-parser');
|
||||
var load = require('../');
|
||||
|
||||
test('pug-load', () => {
|
||||
var filename = __dirname + '/foo.pug';
|
||||
var ast = load.file(filename, {
|
||||
lex: lex,
|
||||
parse: parse
|
||||
});
|
||||
|
||||
ast = walk(ast, function (node) {
|
||||
if (node.filename) node.filename = '<dirname>/' + path.basename(node.filename);
|
||||
if (node.fullPath) node.fullPath = '<dirname>/' + path.basename(node.fullPath);
|
||||
}, {includeDependencies: true});
|
||||
|
||||
expect(ast).toMatchSnapshot();
|
||||
});
|
||||
1
node_modules/pug-load/test/script.js
generated
vendored
Normal file
1
node_modules/pug-load/test/script.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
document.write('hello world!');
|
||||
Reference in New Issue
Block a user