diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-05-26 22:30:06 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-05-26 22:30:06 +0200 |
commit | 346a18b4446060eeb53a0a697fa82f1d13ba6cd2 (patch) | |
tree | 1fbbc6308a94a9b71321817601690b1121571df7 /testing | |
parent | 7b915428f7b780e49b641639c6ba7166132ac87c (diff) | |
parent | b32685c698dd9ca8e2a4083b14d2bc9702ca5e83 (diff) | |
download | gitbook-346a18b4446060eeb53a0a697fa82f1d13ba6cd2.zip gitbook-346a18b4446060eeb53a0a697fa82f1d13ba6cd2.tar.gz gitbook-346a18b4446060eeb53a0a697fa82f1d13ba6cd2.tar.bz2 |
Merge pull request #1335 from GitbookIO/fix/1333
Fix #1333: fix invalid URLs for glossary annotations
Diffstat (limited to 'testing')
-rw-r--r-- | testing/setup.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/testing/setup.js b/testing/setup.js index b91a299..59fef77 100644 --- a/testing/setup.js +++ b/testing/setup.js @@ -2,6 +2,7 @@ var is = require('is'); var path = require('path'); var fs = require('fs'); var expect = require('expect'); +var cheerio = require('cheerio'); expect.extend({ /** @@ -43,6 +44,18 @@ expect.extend({ 'expected to be defined' ); return this; + }, + + /** + Check that a dom element exists in HTML + + @param {String} selector + */ + toHaveDOMElement: function(selector) { + var $ = cheerio.load(this.actual); + var $el = $(selector); + + expect.assert($el.length > 0, 'expected HTML to contains %s', selector); } }); |