How to use the cheerio.dom function in cheerio

To help you get started, we’ve selected a few cheerio 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 matthewmueller / cheerio-select / test / View on Github external
it('should handle complex insertions', function() {
    var a = cheerio('<div><a name="tName1" id="tName1ID">tName1 A</a><a name="tName2" id="tName2ID">tName2 A</a><div id="tName1">tName1 Div</div></div>');
    a = a.children();


    // A little crazy.. basically test if new dom contains inserted elems
    expect($("[name=tName1]", cheerio.dom())[0]).to.equal(a[0]);
    expect($("[name=tName2]", cheerio.dom())[0]).to.equal(a[1]);
    expect($('#tName2ID', cheerio.dom())).to.have.length(1);