diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-05-26 21:37:10 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-05-26 21:37:10 +0200 |
commit | 901328f247388198fff77f411377206222c89390 (patch) | |
tree | b260d737ab759916f9123f302468301d34064f12 /testing/setup.js | |
parent | b47ebaa9d91ecc0a1a1678eb8da79837a3cfee19 (diff) | |
download | gitbook-901328f247388198fff77f411377206222c89390.zip gitbook-901328f247388198fff77f411377206222c89390.tar.gz gitbook-901328f247388198fff77f411377206222c89390.tar.bz2 |
Complete basic tests for glossary
Diffstat (limited to 'testing/setup.js')
-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); } }); |