update tests

pull/2071/head
Rich Harris 6 years ago
parent 687e352209
commit 206a3d0131

@ -3,7 +3,7 @@ const path = require('path');
const { compile } = require('./compiler.js');
let compileOptions = {
extensions: ['.html']
extensions: ['.svelte', '.html']
};
function capitalise(name) {
@ -43,6 +43,7 @@ function registerExtension(extension) {
};
}
registerExtension('.svelte');
registerExtension('.html');
module.exports = register;

@ -1 +1 @@
svelte compile src/Main.html > actual/Main.js
svelte compile src/Main.svelte > actual/Main.js

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte vx.y.z */
/* src/Main.svelte generated by Svelte vx.y.z */
function create_main_fragment(component, ctx) {
var p;

@ -1 +1 @@
svelte compile src/Main.html --customElement > actual/Main.js
svelte compile src/Main.svelte --customElement > actual/Main.js

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte vx.y.z */
/* src/Main.svelte generated by Svelte vx.y.z */
function create_main_fragment(component, ctx) {
var p;

@ -1 +1 @@
svelte compile src/Main.html -d > actual/Main.js
svelte compile src/Main.svelte -d > actual/Main.js

@ -1,6 +1,6 @@
/* src/Main.html generated by Svelte v2.13.4 */
/* src/Main.svelte generated by Svelte v2.13.4 */
const file = "src/Main.html";
const file = "src/Main.svelte";
function create_main_fragment(component, ctx) {
var p;

@ -1,5 +1,5 @@
/* src/Main.html generated by Svelte vx.y.z */
import Widget from './Widget.html';
/* src/Main.svelte generated by Svelte vx.y.z */
import Widget from './Widget.svelte';

@ -1 +1 @@
{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["<Widget/>\n\n<script>\n\timport Widget from './Widget.html';\n\n\texport default {\n\t\tcomponents: {\n\t\t\tWidget\n\t\t}\n\t};\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
{"version":3,"file":"Main.js","sources":["../src/Main.svelte"],"sourcesContent":["<Widget/>\n\n<script>\n\timport Widget from './Widget.svelte';\n\n\texport default {\n\t\tcomponents: {\n\t\t\tWidget\n\t\t}\n\t};\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

@ -1,4 +1,4 @@
/* src/Widget.html generated by Svelte vx.y.z */
/* src/Widget.svelte generated by Svelte vx.y.z */
function create_main_fragment(component, ctx) {
var p;

@ -1 +1 @@
{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["<p>widget</p>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
{"version":3,"file":"Widget.js","sources":["../src/Widget.svelte"],"sourcesContent":["<p>widget</p>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

@ -1,5 +1,5 @@
/* src/Main.html generated by Svelte vx.y.z */
import Widget from './widget/Widget.html';
/* src/Main.svelte generated by Svelte vx.y.z */
import Widget from './widget/Widget.svelte';

@ -1,4 +1,4 @@
/* src/widget/Widget.html generated by Svelte vx.y.z */
/* src/widget/Widget.svelte generated by Svelte vx.y.z */
function create_main_fragment(component, ctx) {
var p;

@ -1,5 +1,5 @@
/* src/Main.html generated by Svelte vx.y.z */
import Widget from './Widget.html';
/* src/Main.svelte generated by Svelte vx.y.z */
import Widget from './Widget.svelte';

@ -1,4 +1,4 @@
/* src/Widget.html generated by Svelte vx.y.z */
/* src/Widget.svelte generated by Svelte vx.y.z */
function create_main_fragment(component, ctx) {
var p;

@ -1 +1 @@
svelte compile src/Main.html -f iife -g the-answer:theAnswer > actual/Main.js
svelte compile src/Main.svelte -f iife -g the-answer:theAnswer > actual/Main.js

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte vx.y.z */
/* src/Main.svelte generated by Svelte vx.y.z */
var Main = (function(answer) { "use strict";
answer = (answer && answer.__esModule) ? answer["default"] : answer;

@ -1 +1 @@
svelte compile src/Main.html -m inline -o actual/Main.js
svelte compile src/Main.svelte -m inline -o actual/Main.js

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte vx.y.z */
/* src/Main.svelte generated by Svelte vx.y.z */
function create_main_fragment(component, ctx) {
var p;

@ -1 +1 @@
svelte compile src/Main.html -m -o actual/Main.js
svelte compile src/Main.svelte -m -o actual/Main.js

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte vx.y.z */
/* src/Main.svelte generated by Svelte vx.y.z */
function create_main_fragment(component, ctx) {
var p;

@ -1 +1 @@
{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["<p>Hello world!</p>\n\n<script>\n\texport default {\n\t\tonrender () {\n\t\t\tconsole.log( 'here' );\n\t\t}\n\t};\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
{"version":3,"file":"Main.js","sources":["../src/Main.svelte"],"sourcesContent":["<p>Hello world!</p>\n\n<script>\n\texport default {\n\t\tonrender () {\n\t\t\tconsole.log( 'here' );\n\t\t}\n\t};\n</script>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

@ -1 +1 @@
svelte compile --generate ssr src/Main.html > actual/Main.js
svelte compile --generate ssr src/Main.svelte > actual/Main.js

@ -2,7 +2,7 @@
var Main = {};
Main.filename = "src/Main.html";
Main.filename = "src/Main.svelte";
Main.data = function() {
return {};

@ -1 +1 @@
svelte compile src/Main.html --store > actual/Main.js
svelte compile src/Main.svelte --store > actual/Main.js

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte vx.y.z */
/* src/Main.svelte generated by Svelte vx.y.z */
function create_main_fragment(component, ctx) {
var h1, text0, text1;

@ -51,7 +51,7 @@ describe('css', () => {
(solo ? it.only : skip ? it.skip : it)(dir, () => {
const config = tryRequire(`./samples/${dir}/_config.js`) || {};
const input = fs
.readFileSync(`test/css/samples/${dir}/input.html`, 'utf-8')
.readFileSync(`test/css/samples/${dir}/input.svelte`, 'utf-8')
.replace(/\s+$/, '');
const expectedWarnings = (config.warnings || []).map(normalizeWarning);

@ -1,6 +1,6 @@
export default {
warnings: [{
filename: "SvelteComponent.html",
filename: "SvelteComponent.svelte",
code: `css-unused-selector`,
message: "Unused CSS selector",
start: {

@ -1,7 +1,7 @@
export default {
warnings: [
{
filename: "SvelteComponent.html",
filename: "SvelteComponent.svelte",
code: `css-unused-selector`,
message: "Unused CSS selector",
start: {
@ -25,7 +25,7 @@ export default {
},
{
filename: "SvelteComponent.html",
filename: "SvelteComponent.svelte",
code: `css-unused-selector`,
message: "Unused CSS selector",
start: {

@ -4,7 +4,7 @@ export default {
},
warnings: [{
filename: "SvelteComponent.html",
filename: "SvelteComponent.svelte",
code: `css-unused-selector`,
message: "Unused CSS selector",
start: {

@ -1,6 +1,6 @@
export default {
warnings: [{
filename: "SvelteComponent.html",
filename: "SvelteComponent.svelte",
code: `css-unused-selector`,
message: "Unused CSS selector",
start: {

@ -72,7 +72,7 @@ describe('custom-elements', function() {
},
transform(code, id) {
if (id.endsWith('.html')) {
if (id.endsWith('.svelte')) {
const compiled = svelte.compile(code, {
customElement: true,
dev: config.dev

@ -1,5 +1,5 @@
import * as assert from 'assert';
import './main.html';
import './main.svelte';
export default async function (target) {
target.innerHTML = '<custom-element></custom-element>';

@ -1,5 +1,5 @@
import * as assert from 'assert';
import CustomElement from './main.html';
import CustomElement from './main.svelte';
export default function (target) {
new CustomElement({

@ -1,5 +1,5 @@
import * as assert from 'assert';
import './main.html';
import './main.svelte';
export default function (target) {
target.innerHTML = `

@ -1,5 +1,5 @@
import * as assert from 'assert';
import './main.html';
import './main.svelte';
export default function (target) {
target.innerHTML = '<custom-element name="world"></custom-element>';

@ -1,5 +1,5 @@
import * as assert from 'assert';
import './main.html';
import './main.svelte';
export default async function (target) {
target.innerHTML = '<my-app/>';

@ -1,5 +1,5 @@
import * as assert from 'assert';
import CustomElement from './main.html';
import CustomElement from './main.svelte';
export default function (target) {
target.innerHTML = '<p>unstyled</p>';

@ -1,5 +1,5 @@
import * as assert from 'assert';
import CustomElement from './main.html';
import CustomElement from './main.svelte';
export default function (target) {
new CustomElement({

@ -1,5 +1,5 @@
import * as assert from 'assert';
import './main.html';
import './main.svelte';
export default function (target) {
const warnings = [];

@ -1,5 +1,5 @@
import * as assert from 'assert';
import './main.html';
import './main.svelte';
export default function (target) {
target.innerHTML = '<my-app/>';

@ -1,5 +1,5 @@
import * as assert from 'assert';
import CustomElement from './main.html';
import CustomElement from './main.svelte';
export default function (target) {
new CustomElement({

@ -171,7 +171,7 @@ export function addLineNumbers(code) {
}
export function showOutput(cwd, options = {}, compile = svelte.compile) {
glob('**/*.html', { cwd }).forEach(file => {
glob('**/*.svelte', { cwd }).forEach(file => {
if (file[0] === '_') return;
const { js } = compile(

@ -18,7 +18,7 @@ describe('hydration', () => {
before(() => {
const svelte = loadSvelte();
require.extensions['.html'] = function(module, filename) {
require.extensions['.svelte'] = function(module, filename) {
const options = Object.assign(
{
filename,
@ -62,7 +62,7 @@ describe('hydration', () => {
let SvelteComponent;
try {
SvelteComponent = require(`${cwd}/main.html`).default;
SvelteComponent = require(`${cwd}/main.svelte`).default;
} catch (err) {
throw err;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save