How to use pa11y - 2 common examples

To help you get started, we’ve selected a few pa11y examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pa11y / pa11y-webservice / route / tasks.js View on Github external
handler: async (request, reply) => {
			if (request.payload.actions && request.payload.actions.length) {
				for (let action of request.payload.actions) {
					if (!isValidAction(action)) {
						return reply.response(`Invalid action: "${action}"`).code(400);
					}
				}
			}

			const task = await model.task.create(request.payload);

			if (!task) {
				return reply.response().code(500);
			}

			return reply.response(task)
				.header('Location', `http://${request.info.host}/tasks/${task.id}`)
				.code(201);
		},
		options: {
github pa11y / pa11y-webservice / route / task.js View on Github external
handler: async (request, reply) => {
			const task = await model.task.getById(request.params.id);

			if (!task) {
				return reply.response('Not Found').code(404);
			}

			if (request.payload.actions && request.payload.actions.length) {
				for (let action of request.payload.actions) {
					if (!isValidAction(action)) {
						return reply.response(`Invalid action: "${action}"`).code(400);
					}
				}
			}
			const updateCount = await model.task.editById(task.id, request.payload);
			if (updateCount < 1) {
				return reply.response().code(500);
			}
			const taskAgain = await model.task.getById(task.id);
			return reply.response(taskAgain).code(200);
		},
		options: {

pa11y

Pa11y is your automated accessibility testing pal

LGPL-3.0
Latest version published 7 months ago

Package Health Score

85 / 100
Full package analysis

Popular pa11y functions