mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
* update autotest api and first few test suites * refactor components-browser to use the new autotest api * minor changes to update adjustIndent and components-pages to new autotest api * refactor and combine async-render, deprecated-async-fragments, and render suites * migrate compiler tests to new autotest runner * migrate components-compilation tests to use new autotest api * migrate most remaining test runners to new autotest api * update adjustIndent * migrate express tests to new autotest api * switch from compare to snapshot * move versions into directory * remove snapshot sequences, prefix to name, suffix to ext * refactor autotest * keep node 4 happy: don't use destructured parameters * use strict * update contributing document to reflect new autotest api * better snapshot errors with clickable path * remove old vdomSkip property, fix some normalization in the render test runner, skip only tests that need to be skipped * for generated vdom expectations use expected.html instead of rerendering the html template, update expected files that had editor added newlines at the end * remove half-finished test that was intended to replace another test (render/fixtures/preserveWhitespace-load-option) - we'll keep the original
36 lines
1.3 KiB
JavaScript
36 lines
1.3 KiB
JavaScript
var nodePath = require("path");
|
|
var fs = require("fs");
|
|
|
|
exports.check = function(marko, markoCompiler, expect, snapshot, done) {
|
|
var template;
|
|
var templatePath;
|
|
|
|
// Make sure calling load with templatePath:String, templateSrc:String arguments works
|
|
templatePath = nodePath.join(__dirname, "dummy.marko");
|
|
template = marko.load(templatePath, "-- Hello $!{data.name}!");
|
|
snapshot(template.renderSync({ name: "Frank" }).toString());
|
|
|
|
// Make sure calling load with templatePath:String, templateSrc:String, options:Object arguments works
|
|
templatePath = nodePath.join(__dirname, "dummy.marko");
|
|
template = marko.load(templatePath, "-- Hello $!{data.name}!", {});
|
|
snapshot(template.renderSync({ name: "Frank" }).toString());
|
|
|
|
// Make sure calling load with templatePath:String, options:Object arguments works
|
|
delete markoCompiler.defaultOptions.writeToDisk;
|
|
|
|
templatePath = nodePath.join(__dirname, "template.marko");
|
|
var compiledPath = nodePath.join(__dirname, "template.marko.js");
|
|
|
|
try {
|
|
fs.unlinkSync(compiledPath);
|
|
} catch (e) {
|
|
// ignore
|
|
}
|
|
|
|
template = marko.load(templatePath, { writeToDisk: false });
|
|
expect(fs.existsSync(compiledPath)).to.equal(false);
|
|
expect(template.render).to.be.a("function");
|
|
snapshot(template.renderSync({ name: "Frank" }).toString());
|
|
done();
|
|
};
|