Merge branch 'master' into pr/7066

pull/7066/head
Conduitry 5 years ago
commit e475e1b79d

52
.github/stale.yml vendored

@ -1,52 +0,0 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- popular
- pinned
- security
- bug
- "[Status] Maybe Later"
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false
# Label to use when marking as stale
staleLabel: stale-bot
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 1
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
pulls:
daysUntilStale: 210
daysUntilClose: 25
markComment: >
This pull request has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
closeComment: >
This pull request has been closed as it was previously marked as stale and saw no subsequent activity.
issues:
daysUntilStale: 180
daysUntilClose: 14
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
closeComment: >
This issue has been closed as it was previously marked as stale and saw no subsequent activity.

@ -1,8 +1,9 @@
# Svelte changelog
## unreleased
## Unreleased
* Fix non-boolean attribute rendering in SSR to render truthy values as is, making it consistent with DOM rendering. ([#6121](https://github.com/sveltejs/svelte/issues/6121))
* Fix non-boolean attribute rendering in SSR to render truthy values as-is ([#6121](https://github.com/sveltejs/svelte/issues/6121))
* Add `a11y-no-redundant-roles` warning ([#7067](https://github.com/sveltejs/svelte/pull/7067))
## 3.44.3

@ -1,4 +1,4 @@
Copyright (c) 2016-21 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
Copyright (c) 2016-22 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@ -83,8 +83,8 @@
},
"types": "types/runtime/index.d.ts",
"scripts": {
"test": "mocha",
"test:unit": "mocha --require sucrase/register --recursive src/**/__test__.ts",
"test": "mocha --exit",
"test:unit": "mocha --require sucrase/register --recursive src/**/__test__.ts --exit",
"quicktest": "mocha",
"precoverage": "c8 mocha",
"coverage": "c8 report --reporter=text-lcov > coverage.lcov && c8 report --reporter=html",

@ -94,4 +94,4 @@ We don't take this lightly: hopefully once you've experienced Svelte 3 you'll un
As grueling as this release has been, we're nowhere near finished. We have a ton of ideas for generating smarter, more compact code, and a long feature wish-list. [Sapper](https://sapper.svelte.dev), our Next.js-style app framework, is still in the middle of being updated to use Svelte 3. The [Svelte Native](https://svelte-native.technology/) community project, which allows you to write Android and iOS apps in Svelte, is making solid progress but deserves more complete support from core. We don't yet have the bounty of editor extensions, syntax highlighters, component kits, devtools and so on that other frameworks have, and we should fix that. We *really* want to add first-class TypeScript support.
But in the meantime we think Svelte 3 is the best way to build web apps yet. Take an hour to go through the [tutorial](/tutorial) and we hope to convince you of the same. Either way, we'd love to see you in our [Discord chatroom](/chat) and on [GitHub](https://github.com/sveltejs/svelte) — everyone is welcome, especially you.
But in the meantime we think Svelte 3 is the best way to build web apps yet. Take an hour to go through the [tutorial](/tutorial) and we hope to convince you of the same. Either way, we'd love to see you in our [Discord chatroom](https://svelte.dev/chat) and on [GitHub](https://github.com/sveltejs/svelte) — everyone is welcome, especially you.

@ -0,0 +1,77 @@
---
title: "What's new in Svelte: January 2022"
description: "Faster builds with SvelteKit and a much anticipated REPL feature"
author: Daniel Sandoval
authorURL: https://desandoval.net
---
Happy new year, Svelte Community! Lots to share this month across Svelte, SvelteKit, Language Tools and the Showcase. Thanks to everyone who made 2021 a great year to use Svelte. Looking forward to the next one 🚀
## What's new in SvelteKit
- `@sveltejs/adapter-static` for SvelteKit now has a `precompress` option to make brotli compression of assets and pages easier to do out of the box ([#3079](https://github.com/sveltejs/kit/pull/3079))
- Concurrency mode in SvelteKit will now prerender pages in parallel ([#3120](https://github.com/sveltejs/kit/pull/3120)). It is enabled by default in `1.0.0-next.205` and later
- CSS is now automatically included before JS for improved page performance ([d13efe](https://github.com/sveltejs/kit/commit/d138efe21692f5925f1e89afc0a33f42d6a1a711))
- A new config option adds the ability to disable service worker registration to do your own custom registration ([#2988](https://github.com/sveltejs/kit/pull/2988))
- SSR route-splitting is here - breaking monolithic builds into smaller pieces for improved startup and routing performance ([#2931](https://github.com/sveltejs/kit/pull/2931))
- `request.origin/path/query` is now `request.url` - simplifying the config and page `load` functions ([#3126](https://github.com/sveltejs/kit/pull/3126))
- After the [update to Vite 2.7](https://github.com/sveltejs/kit/pull/3018), SvelteKit users are [reporting significant performance improvements](https://www.reddit.com/r/sveltejs/comments/rljhfc/sveltekit_massive_compiler_improvement_by/) and loading third-parties libraries in SSR has also been greatly improved
- SvelteKit server will now automatically restart when the config files is changed ([vite-plugin-svelte#237](https://github.com/sveltejs/vite-plugin-svelte/pull/237))
## Other new bits from `svelte/*`
- [Svelte 3.44.3](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md#3443) is out with a few bug fixes in the binding and loop code
- Svelte Language Tools has introduced support for the then/catch shorthands from Svelte 3.41 and TypeScript's "go to" functionality ([105.8.0 and later](https://github.com/sveltejs/language-tools/releases/tag/extensions-105.8.0))
- The Svelte REPL got a nice upgrade as well - letting you delete saved REPLs. Try it out by logging in at [svelte.dev/apps](https://svelte.dev/apps)
---
## Community Showcase
**Apps & Sites**
- [Discover Twitter Spaces](https://github.com/navneetsharmaui/discover-twitter-spaces) is a tool that helps you find the Twitter Spaces
- [Modern Fluid Typography Editor](https://github.com/codeAdrian/modern-fluid-typography-editor) helps create beautiful fluid typography using CSS clamp
- [Unnwhiteboard](https://github.com/AviKKi/unnwhiteboard) is a job board for companies (or teams) that don't do "whiteboard" interviews
- [Secret Santa](https://gitlab.com/arturoguzman/secret-santa-sveltekit) is a gift giving coordination app developed with easiness in mind
- [LogSnag](https://logsnag.com/) notifies you of your projects' events and provides you with a timeline to keep track of anything important that happens
- [Version 0.2 of Tangent](http://tangentnotes.com/Download), a Svelte-based note writing app, is now in beta
- [Intl Explorer](https://github.com/jesperorb/intl-explorer) is a tool for viewing output for all possible formatters for Intl
A lot of work this month has gone into migrating the Svelte main website and Svelte REPL to live in the https://github.com/sveltejs/sites repository - including a brand new homepage for [svelte.dev](https://svelte.dev/). Thanks to all the contributors who made this possible!
If you're looking for a fun SvelteKit project to work on, [you can contribute to the Svelte Society site rewrite](https://github.com/svelte-society/sveltesociety-2021/issues) 💅
**Learning and Listening**
_To Read_
- [Mutating Query Params in SvelteKit Without Page Reloads or Navigations](https://dev.to/mohamadharith/mutating-query-params-in-sveltekit-without-page-reloads-or-navigations-2i2b) by Mohamad Harith
- [Svelte for Reactaholics : A guide for React developers](https://www.100ms.live/blog/svelte-guide-for-react-developers) by Puru Vijay
- [Svelte's lifecycle methods can be used anywhere](https://geoffrich.net/posts/svelte-lifecycle-examples/) and [The many meanings of $ in Svelte](https://geoffrich.net/posts/svelte-$-meanings/) by Geoff Rich
- [Vercel and Svelte: A Perfect Match for Web Developers](https://thenewstack.io/vercel-and-svelte-a-perfect-match-for-web-developers/) by Darryl K. Taft
- [User-defined TailwindCSS Color Scheme with Svelte Stores](https://blog.dayslice.io/user-defined-tailwindcss-color-scheme-with-svelte-stores-ad80ca2cf038) by jeremy zaborowski
- [Ionic 6 + Svelte 🚀](https://medium.com/@raymondboswel/ionic-6-svelte-ae904caa82df) by Raymond Boswel
- [What happened in #Svelte language tools this year](https://twitter.com/dummdidumm_/status/1474158105395179525?t=ytj2K2Q52iD5-lNyLnQaAQ&s=19) by Simon H
_To Watch_
- [The Future of Svelte (Interview with Rich Harris)](https://www.youtube.com/watch?v=uQntFkK8Z54) by Lee Robinson, Director of Developer Relations at Vercel
- [Svelte is becoming the go-to framework](https://www.youtube.com/watch?v=fo6BKY2xR2w&t=1834s) for Obsidian plugin developers
- [Sveltekit WordPress Headless Blog](https://www.youtube.com/watch?v=c0UDVgjPxFw) by WebJeda
- [Getting started with SvelteKit](https://www.youtube.com/watch?v=i2suPKMPUFA) by Lihau Tan
- [Deploy a full-stack SvelteKit app on Cloudflare Pages](https://www.youtube.com/watch?v=Wc1_U6Dy5Tw) by 1nf
_To Listen To_
- [Syntax podcast: How To Do Things In Svelte](https://podcasts.apple.com/ca/podcast/how-to-do-things-in-svelte/id1253186678?i=1000544796072)
- [JS Party #205: So much Sveltey goodness (w/ Rich Harris)](https://changelog.com/jsparty/205)
**Libraries, Tools & Components**
- [svelte-headlessui](https://github.com/rgossiaux/svelte-headlessui) is an unofficial, complete Svelte port of the Headless UI component library
- [svelte-forms v2](https://chainlist.github.io/svelte-forms/) has been released - the author is [looking for feedback](https://www.reddit.com/r/sveltejs/comments/r6354j/svelteforms_v2_has_been_released/)
- [Percival](https://github.com/ekzhang/percival) is a declarative data query and visualization language
- [Svelte FlatList](https://github.com/snuffyDev/svelte-flatlist) is a mobile-friendly, simple, and customizable draggable menu
- [svelte-keyed](https://github.com/bryanmylee/svelte-keyed) is a writable derived store for objects and arrays
- [Svemix](https://github.com/svemix/svemix) is Remix for Svelte - providing server scripts inside your Svelte components/routes, which will be transformed into endpoints
Want to add something to the showcase? Need help bringing your next idea to life in Svelte? Join us on [Reddit](https://www.reddit.com/r/sveltejs/) or [Discord](https://discord.com/invite/yy75DKs).
See ya next month!

@ -6,6 +6,6 @@ This page contains detailed API reference documentation. It's intended to be a r
If that's not you (yet), you may prefer to visit the [interactive tutorial](/tutorial) or the [examples](/examples) before consulting this reference.
Don't be shy about asking for help in the [Discord chatroom](/chat).
Don't be shy about asking for help in the [Discord chatroom](https://svelte.dev/chat).
Using an older version of Svelte? Have a look at the [v2 docs](https://v2.svelte.dev).

@ -50,7 +50,7 @@
</script>
<h1>Caminandes: Llamigos</h1>
<p>From <a href="https://cloud.blender.org/open-projects">Blender Open Projects</a>. CC-BY</p>
<p>From <a href="https://studio.blender.org/films">Blender Studio</a>. CC-BY</p>
<div>
<video

@ -50,7 +50,7 @@
</script>
<h1>Caminandes: Llamigos</h1>
<p>From <a href="https://cloud.blender.org/open-projects">Blender Open Projects</a>. CC-BY</p>
<p>From <a href="https://studio.blender.org/films">Blender Studio</a>. CC-BY</p>
<div>
<video

@ -50,7 +50,7 @@
</script>
<h1>Caminandes: Llamigos</h1>
<p>From <a href="https://cloud.blender.org/open-projects">Blender Open Projects</a>. CC-BY</p>
<p>From <a href="https://studio.blender.org/films">Blender Studio</a>. CC-BY</p>
<div>
<video

@ -8,4 +8,4 @@ To get set up in your local development environment, check out [the quickstart g
If you're looking for a more expansive framework that includes routing, server-side rendering and everything else, take a look at [SvelteKit](https://kit.svelte.dev).
Most importantly: since you're now a member of the Svelte community, you should [join our friendly Discord chatroom](/chat). That's where you'll find fellow Svelte users, and it's where we plan the future of the framework.
Most importantly: since you're now a member of the Svelte community, you should [join our friendly Discord chatroom](https://svelte.dev/chat). That's where you'll find fellow Svelte users, and it's where we plan the future of the framework.

@ -76,6 +76,10 @@ export default {
code: 'a11y-unknown-role',
message: `A11y: Unknown role '${role}'` + (suggestion ? ` (did you mean '${suggestion}'?)` : '')
}),
a11y_no_redundant_roles: (role: string | boolean) => ({
code: 'a11y-no-redundant-roles',
message: `A11y: Redundant role '${role}'`
}),
a11y_accesskey: {
code: 'a11y-accesskey',
message: 'A11y: Avoid using accesskey'

@ -70,6 +70,46 @@ const a11y_labelable = new Set([
'textarea'
]);
const a11y_nested_implicit_semantics = new Map([
['header', 'banner'],
['footer', 'contentinfo']
]);
const a11y_implicit_semantics = new Map([
['a', 'link'],
['aside', 'complementary'],
['body', 'document'],
['datalist', 'listbox'],
['dd', 'definition'],
['dfn', 'term'],
['details', 'group'],
['dt', 'term'],
['fieldset', 'group'],
['form', 'form'],
['h1', 'heading'],
['h2', 'heading'],
['h3', 'heading'],
['h4', 'heading'],
['h5', 'heading'],
['h6', 'heading'],
['hr', 'separator'],
['li', 'listitem'],
['menu', 'list'],
['nav', 'navigation'],
['ol', 'list'],
['optgroup', 'group'],
['output', 'status'],
['progress', 'progressbar'],
['section', 'region'],
['summary', 'button'],
['tbody', 'rowgroup'],
['textarea', 'textbox'],
['tfoot', 'rowgroup'],
['thead', 'rowgroup'],
['tr', 'row'],
['ul', 'list']
]);
const invisible_elements = new Set(['meta', 'html', 'script', 'style']);
const valid_modifiers = new Set([
@ -98,6 +138,23 @@ const react_attributes = new Map([
const attributes_to_compact_whitespace = ['class', 'style'];
function is_parent(parent: INode, elements: string[]) {
let check = false;
while (parent) {
const parent_name = (parent as Element).name;
if (elements.includes(parent_name)) {
check = true;
break;
}
if (parent.type === 'Element') {
break;
}
parent = parent.parent;
}
return check;
}
function get_namespace(parent: Element, element: Element, explicit_namespace: string) {
const parent_element = parent.find_nearest(/^Element/);
@ -351,6 +408,22 @@ export default class Element extends Node {
const match = fuzzymatch(value, aria_roles);
component.warn(attribute, compiler_warnings.a11y_unknown_role(value, match));
}
// no-redundant-roles
const has_redundant_role = value === a11y_implicit_semantics.get(this.name);
if (this.name === value || has_redundant_role) {
component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value));
}
// Footers and headers are special cases, and should not have redundant roles unless they are the children of sections or articles.
const is_parent_section_or_article = is_parent(this.parent, ['section', 'article']);
if (!is_parent_section_or_article) {
const has_nested_redundant_role = value === a11y_nested_implicit_semantics.get(this.name);
if (has_nested_redundant_role) {
component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value));
}
}
}
// no-access-key

@ -1,6 +1,6 @@
// The `foreign` namespace covers all DOM implementations that aren't HTML5.
// It opts out of HTML5-specific a11y checks and case-insensitive attribute names.
export const foreign = 'https://svelte.dev/docs#svelte_options';
export const foreign = 'https://svelte.dev/docs#template-syntax-svelte-options';
export const html = 'http://www.w3.org/1999/xhtml';
export const mathml = 'http://www.w3.org/1998/Math/MathML';
export const svg = 'http://www.w3.org/2000/svg';

@ -4,7 +4,7 @@ import * as http from 'http';
import { rollup } from 'rollup';
import virtual from '@rollup/plugin-virtual';
import puppeteer from 'puppeteer';
import { addLineNumbers, loadConfig, loadSvelte } from '../helpers';
import { addLineNumbers, loadConfig, loadSvelte, retryAsync, executeBrowserTest } from '../helpers';
import { deepEqual } from 'assert';
const page = `
@ -17,8 +17,8 @@ const page = `
const assert = fs.readFileSync(`${__dirname}/assert.js`, 'utf-8');
describe('custom-elements', function() {
// Note: Increase the timeout in preparation for restarting Chromium due to SIGSEGV.
this.timeout(10000);
let svelte;
let server;
let browser;
@ -44,12 +44,16 @@ describe('custom-elements', function() {
});
}
async function launchPuppeteer() {
return await retryAsync(() => puppeteer.launch());
}
before(async () => {
svelte = loadSvelte();
console.log('[custom-element] Loaded Svelte');
server = await create_server();
console.log('[custom-element] Started server');
browser = await puppeteer.launch();
browser = await launchPuppeteer();
console.log('[custom-element] Launched puppeteer browser');
});
@ -108,26 +112,7 @@ describe('custom-elements', function() {
const result = await bundle.generate({ format: 'iife', name: 'test' });
code = result.output[0].code;
const page = await browser.newPage();
page.on('console', (type) => {
console[type._type](type._text);
});
page.on('error', error => {
console.log('>>> an error happened');
console.error(error);
});
try {
await page.goto('http://localhost:6789');
const result = await page.evaluate(() => test(document.querySelector('main')));
if (result) console.log(result);
} catch (err) {
console.log(addLineNumbers(code));
throw err;
} finally {
function assertWarnings() {
if (expected_warnings) {
deepEqual(warnings.map(w => ({
code: w.code,
@ -138,6 +123,15 @@ describe('custom-elements', function() {
})), expected_warnings);
}
}
browser = await executeBrowserTest(
browser,
launchPuppeteer,
assertWarnings,
() => {
console.log(addLineNumbers(code));
assertWarnings();
});
});
});
});

@ -8,7 +8,7 @@ export const assert = (assert$1 as unknown) as typeof assert$1 & { htmlEqual: (a
// for coverage purposes, we need to test source files,
// but for sanity purposes, we need to test dist files
export function loadSvelte(test) {
export function loadSvelte(test: boolean = false) {
process.env.TEST = test ? 'true' : '';
const resolved = require.resolve('../compiler.js');
@ -55,7 +55,7 @@ export function cleanRequireCache() {
const virtualConsole = new jsdom.VirtualConsole();
virtualConsole.sendTo(console);
const window = new jsdom.JSDOM('<main></main>', {virtualConsole}).window;
const window = new jsdom.JSDOM('<main></main>', { virtualConsole }).window;
global.document = window.document;
global.navigator = window.navigator;
global.getComputedStyle = window.getComputedStyle;
@ -279,3 +279,50 @@ export function prettyPrintPuppeteerAssertionError(message) {
assert.equal(match[1], match[2]);
}
}
export async function retryAsync<T>(fn: () => Promise<T>, maxAttempts: number = 3, interval: number = 1000): Promise<T> {
let attempts = 0;
while (attempts <= maxAttempts) {
try {
return await fn();
} catch (err) {
if (++attempts >= maxAttempts) throw err;
await new Promise(resolve => setTimeout(resolve, interval));
}
}
}
// NOTE: Chromium may exit with SIGSEGV, so retry in that case
export async function executeBrowserTest<T>(browser, launchPuppeteer: () => Promise<T>, additionalAssertion: () => void, onError: (err: Error) => void) {
let count = 0;
do {
count++;
try {
const page = await browser.newPage();
page.on('console', (type) => {
console[type._type](type._text);
});
page.on('error', error => {
console.log('>>> an error happened');
console.error(error);
});
await page.goto('http://localhost:6789');
const result = await page.evaluate(() => test(document.querySelector('main')));
if (result) console.log(result);
additionalAssertion();
await page.close();
break;
} catch (err) {
if (count === 5 || browser.isConnected()) {
onError(err);
throw err;
}
console.debug(err.stack || err);
console.log('RESTARTING Chromium...');
browser = await launchPuppeteer();
}
} while (count <= 5);
return browser;
}

@ -18,8 +18,8 @@ function create_fragment(ctx) {
return {
c() {
svg = document.createElementNS("https://svelte.dev/docs#svelte_options", "svg");
img = document.createElementNS("https://svelte.dev/docs#svelte_options", "img");
svg = document.createElementNS("https://svelte.dev/docs#template-syntax-svelte-options", "svg");
img = document.createElementNS("https://svelte.dev/docs#template-syntax-svelte-options", "img");
this.h();
},
l(nodes) {

@ -9,7 +9,9 @@ import {
loadConfig,
loadSvelte,
mkdirp,
prettyPrintPuppeteerAssertionError
prettyPrintPuppeteerAssertionError,
retryAsync,
executeBrowserTest
} from '../helpers';
import { deepEqual } from 'assert';
@ -48,15 +50,21 @@ function create_server() {
});
}
async function launchPuppeteer() {
return await retryAsync(() => puppeteer.launch());
}
const assert = fs.readFileSync(`${__dirname}/assert.js`, 'utf-8');
describe('runtime (puppeteer)', () => {
describe('runtime (puppeteer)', function() {
// Note: Increase the timeout in preparation for restarting Chromium due to SIGSEGV.
this.timeout(10000);
before(async () => {
svelte = loadSvelte(false);
console.log('[runtime-puppeteer] Loaded Svelte');
server = await create_server();
console.log('[runtime-puppeteer] Started server');
browser = await puppeteer.launch();
browser = await launchPuppeteer();
console.log('[runtime-puppeteer] Launched puppeteer browser');
});
@ -205,27 +213,7 @@ describe('runtime (puppeteer)', () => {
const result = await bundle.generate({ format: 'iife', name: 'test' });
code = result.output[0].code;
const page = await browser.newPage();
page.on('console', (type) => {
console[type._type](type._text);
});
page.on('error', error => {
console.log('>>> an error happened');
console.error(error);
});
try {
await page.goto('http://localhost:6789');
const result = await page.evaluate(() => test(document.querySelector('main')));
if (result) console.log(result);
} catch (err) {
failed.add(dir);
prettyPrintPuppeteerAssertionError(err.message);
throw err;
} finally {
function assertWarnings() {
if (config.warnings) {
deepEqual(warnings.map(w => ({
code: w.code,
@ -240,6 +228,16 @@ describe('runtime (puppeteer)', () => {
throw new Error('Received unexpected warnings');
}
}
browser = await executeBrowserTest(
browser,
launchPuppeteer,
assertWarnings,
(err) => {
failed.add(dir);
prettyPrintPuppeteerAssertionError(err.message);
assertWarnings();
});
});
}

@ -65,7 +65,7 @@ describe('runtime', () => {
}
const testName = `${dir} ${hydrate ? `(with hydration${from_ssr_html ? ' from ssr rendered html' : ''})` : ''}`;
(config.skip ? it.skip : solo ? it.only : it)(testName, () => {
(config.skip ? it.skip : solo ? it.only : it)(testName, (done) => {
if (failed.has(dir)) {
// this makes debugging easier, by only printing compiled output once
throw new Error('skipping test, already failed');
@ -120,7 +120,7 @@ describe('runtime', () => {
}
});
return Promise.resolve()
Promise.resolve()
.then(() => {
// hack to support transition tests
clear_loops();
@ -245,6 +245,7 @@ describe('runtime', () => {
.catch(err => {
// print a clickable link to open the directory
err.stack += `\n\ncmd-click: ${path.relative(process.cwd(), cwd)}/main.svelte`;
done();
throw err;
})
.then(() => {
@ -255,6 +256,7 @@ describe('runtime', () => {
flush();
if (config.after_test) config.after_test();
done();
});
});
}

@ -52,7 +52,10 @@ describe('ssr', () => {
throw new Error('Forgot to remove `solo: true` from test');
}
(solo ? it.only : it)(dir, () => {
(solo ? it.only : it)(dir, (done) => {
try {
dir = path.resolve(`${__dirname}/samples`, dir);
cleanRequireCache();
@ -66,7 +69,6 @@ describe('ssr', () => {
require('../../register')(compileOptions);
try {
const Component = require(`${dir}/main.svelte`).default;
const expectedHtml = tryToReadFile(`${dir}/_expected.html`);
@ -132,6 +134,7 @@ describe('ssr', () => {
throw err;
} finally {
set_current_component(null);
done();
}
});
});

@ -0,0 +1,44 @@
<a href="/" role="link">a link</a>
<article role="article" />
<aside role="complementary" />
<body role="document" />
<button role="button" />
<datalist role="listbox" />
<dd role="definition" />
<dfn role="term" />
<details role="group" />
<dialog role="dialog" />
<dt role="term" />
<fieldset role="group" />
<figure role="figure" />
<form role="form">foo</form>
<h1 role="heading">heading</h1>
<h2 role="heading">heading</h2>
<h3 role="heading">heading</h3>
<h4 role="heading">heading</h4>
<h5 role="heading">heading</h5>
<h6 role="heading">heading</h6>
<hr role="separator" />
<li role="listitem" />
<link role="link" />
<main role="main"></main>
<menu role="list" />
<nav role="navigation" />
<ol role="list" />
<optgroup role="group" />
<option role="option" />
<output role="status" />
<progress role="progressbar" />
<section role="region" />
<summary role="button" />
<table role="table" />
<tbody role="rowgroup" />
<textarea role="textbox" />
<tfoot role="rowgroup" />
<thead role="rowgroup" />
<tr role="row" />
<ul role="list" />
<!-- Tested header/footer not nested in section/article -->
<header role="banner"></header>
<footer role="contentinfo"></footer>

@ -0,0 +1,632 @@
[
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 23,
"column": 23,
"line": 1
},
"message": "A11y: Redundant role 'link'",
"pos": 12,
"start": {
"character": 12,
"column": 12,
"line": 1
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 58,
"column": 23,
"line": 2
},
"message": "A11y: Redundant role 'article'",
"pos": 44,
"start": {
"character": 44,
"column": 9,
"line": 2
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 89,
"column": 27,
"line": 3
},
"message": "A11y: Redundant role 'complementary'",
"pos": 69,
"start": {
"character": 69,
"column": 7,
"line": 3
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 114,
"column": 21,
"line": 4
},
"message": "A11y: Redundant role 'document'",
"pos": 99,
"start": {
"character": 99,
"column": 6,
"line": 4
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 139,
"column": 21,
"line": 5
},
"message": "A11y: Redundant role 'button'",
"pos": 126,
"start": {
"character": 126,
"column": 8,
"line": 5
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 167,
"column": 24,
"line": 6
},
"message": "A11y: Redundant role 'listbox'",
"pos": 153,
"start": {
"character": 153,
"column": 10,
"line": 6
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 192,
"column": 21,
"line": 7
},
"message": "A11y: Redundant role 'definition'",
"pos": 175,
"start": {
"character": 175,
"column": 4,
"line": 7
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 212,
"column": 16,
"line": 8
},
"message": "A11y: Redundant role 'term'",
"pos": 201,
"start": {
"character": 201,
"column": 5,
"line": 8
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 237,
"column": 21,
"line": 9
},
"message": "A11y: Redundant role 'group'",
"pos": 225,
"start": {
"character": 225,
"column": 9,
"line": 9
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 262,
"column": 21,
"line": 10
},
"message": "A11y: Redundant role 'dialog'",
"pos": 249,
"start": {
"character": 249,
"column": 8,
"line": 10
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 281,
"column": 15,
"line": 11
},
"message": "A11y: Redundant role 'term'",
"pos": 270,
"start": {
"character": 270,
"column": 4,
"line": 11
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 307,
"column": 22,
"line": 12
},
"message": "A11y: Redundant role 'group'",
"pos": 295,
"start": {
"character": 295,
"column": 10,
"line": 12
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 332,
"column": 21,
"line": 13
},
"message": "A11y: Redundant role 'figure'",
"pos": 319,
"start": {
"character": 319,
"column": 8,
"line": 13
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 353,
"column": 17,
"line": 14
},
"message": "A11y: Redundant role 'form'",
"pos": 342,
"start": {
"character": 342,
"column": 6,
"line": 14
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 383,
"column": 18,
"line": 15
},
"message": "A11y: Redundant role 'heading'",
"pos": 369,
"start": {
"character": 369,
"column": 4,
"line": 15
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 415,
"column": 18,
"line": 16
},
"message": "A11y: Redundant role 'heading'",
"pos": 401,
"start": {
"character": 401,
"column": 4,
"line": 16
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 447,
"column": 18,
"line": 17
},
"message": "A11y: Redundant role 'heading'",
"pos": 433,
"start": {
"character": 433,
"column": 4,
"line": 17
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 479,
"column": 18,
"line": 18
},
"message": "A11y: Redundant role 'heading'",
"pos": 465,
"start": {
"character": 465,
"column": 4,
"line": 18
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 511,
"column": 18,
"line": 19
},
"message": "A11y: Redundant role 'heading'",
"pos": 497,
"start": {
"character": 497,
"column": 4,
"line": 19
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 543,
"column": 18,
"line": 20
},
"message": "A11y: Redundant role 'heading'",
"pos": 529,
"start": {
"character": 529,
"column": 4,
"line": 20
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 577,
"column": 20,
"line": 21
},
"message": "A11y: Redundant role 'separator'",
"pos": 561,
"start": {
"character": 561,
"column": 4,
"line": 21
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 600,
"column": 19,
"line": 22
},
"message": "A11y: Redundant role 'listitem'",
"pos": 585,
"start": {
"character": 585,
"column": 4,
"line": 22
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 621,
"column": 17,
"line": 23
},
"message": "A11y: Redundant role 'link'",
"pos": 610,
"start": {
"character": 610,
"column": 6,
"line": 23
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 642,
"column": 17,
"line": 24
},
"message": "A11y: Redundant role 'main'",
"pos": 631,
"start": {
"character": 631,
"column": 6,
"line": 24
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 668,
"column": 17,
"line": 25
},
"message": "A11y: Redundant role 'list'",
"pos": 657,
"start": {
"character": 657,
"column": 6,
"line": 25
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 694,
"column": 22,
"line": 26
},
"message": "A11y: Redundant role 'navigation'",
"pos": 677,
"start": {
"character": 677,
"column": 5,
"line": 26
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 713,
"column": 15,
"line": 27
},
"message": "A11y: Redundant role 'list'",
"pos": 702,
"start": {
"character": 702,
"column": 4,
"line": 27
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 739,
"column": 22,
"line": 28
},
"message": "A11y: Redundant role 'group'",
"pos": 727,
"start": {
"character": 727,
"column": 10,
"line": 28
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 764,
"column": 21,
"line": 29
},
"message": "A11y: Redundant role 'option'",
"pos": 751,
"start": {
"character": 751,
"column": 8,
"line": 29
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 789,
"column": 21,
"line": 30
},
"message": "A11y: Redundant role 'status'",
"pos": 776,
"start": {
"character": 776,
"column": 8,
"line": 30
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 821,
"column": 28,
"line": 31
},
"message": "A11y: Redundant role 'progressbar'",
"pos": 803,
"start": {
"character": 803,
"column": 10,
"line": 31
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 847,
"column": 22,
"line": 32
},
"message": "A11y: Redundant role 'region'",
"pos": 834,
"start": {
"character": 834,
"column": 9,
"line": 32
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 873,
"column": 22,
"line": 33
},
"message": "A11y: Redundant role 'button'",
"pos": 860,
"start": {
"character": 860,
"column": 9,
"line": 33
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 896,
"column": 19,
"line": 34
},
"message": "A11y: Redundant role 'table'",
"pos": 884,
"start": {
"character": 884,
"column": 7,
"line": 34
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 922,
"column": 22,
"line": 35
},
"message": "A11y: Redundant role 'rowgroup'",
"pos": 907,
"start": {
"character": 907,
"column": 7,
"line": 35
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 950,
"column": 24,
"line": 36
},
"message": "A11y: Redundant role 'textbox'",
"pos": 936,
"start": {
"character": 936,
"column": 10,
"line": 36
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 976,
"column": 22,
"line": 37
},
"message": "A11y: Redundant role 'rowgroup'",
"pos": 961,
"start": {
"character": 961,
"column": 7,
"line": 37
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 1002,
"column": 22,
"line": 38
},
"message": "A11y: Redundant role 'rowgroup'",
"pos": 987,
"start": {
"character": 987,
"column": 7,
"line": 38
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 1020,
"column": 14,
"line": 39
},
"message": "A11y: Redundant role 'row'",
"pos": 1010,
"start": {
"character": 1010,
"column": 4,
"line": 39
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 1039,
"column": 15,
"line": 40
},
"message": "A11y: Redundant role 'list'",
"pos": 1028,
"start": {
"character": 1028,
"column": 4,
"line": 40
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 1125,
"column": 21,
"line": 43
},
"message": "A11y: Redundant role 'banner'",
"pos": 1112,
"start": {
"character": 1112,
"column": 8,
"line": 43
}
},
{
"code": "a11y-no-redundant-roles",
"end": {
"character": 1162,
"column": 26,
"line": 44
},
"message": "A11y: Redundant role 'contentinfo'",
"pos": 1144,
"start": {
"character": 1144,
"column": 8,
"line": 44
}
}
]
Loading…
Cancel
Save