UNPKG

grunt-html-dom-snapshot

Version:

Takes snapshots of the HTML markup on web pages - their immediate DOM content - and screenshots of their viewport - how they look like.

25 lines (21 loc) 660 B
'use strict' const { checkSingleElement } = require('./utils/elements') module.exports = { detect: function (command) { return !!command.isEnabled }, perform: async function (grunt, target, client, command, options) { const isEnabled = command.isEnabled grunt.log.ok('Checking if "' + isEnabled + '" is enabled.') if (options.singleElementSelections) { await checkSingleElement(client, isEnabled) } return client.$(isEnabled) .then(element => element.isEnabled()) .then(function (value) { if (value !== true) { throw new Error('"' + isEnabled + '" is not enabled.') } }) } }