diff --git a/cheerio/cheerio-test.ts b/cheerio/cheerio-tests.ts similarity index 93% rename from cheerio/cheerio-test.ts rename to cheerio/cheerio-tests.ts index b2a5d84f3..00cc95ee8 100644 --- a/cheerio/cheerio-test.ts +++ b/cheerio/cheerio-tests.ts @@ -1,65 +1,65 @@ -/// - -import cheerio = module("cheerio"); - -var $ = cheerio.load(""); -var $el = $('selector'); -var $multiEl = $('seletor', 'selector', 'selector'); - -$el.addClass("class").addClass("test"); -$el.hasClass("test"); -$el.removeClass("class").removeClass("test"); - -$el.attr('class'); -$el.attr('class', 'test'); -$el.removeAttr("class").removeAttr("test"); - -$el.find("ul").find("> li"); - -$el.parent().parent(); -$el.next().next(); -$el.prev().prev(); -$el.siblings().siblings(); - -$el.children().children(); -$el.children("li").children("a"); - -$el.children().each((index, element) => { - $(element).find('t'); -}); - -$el.children().map((index, element) => { - return $(element).find('t'); -}); - -$el.children().filter((index) => { - return $el.children().eq(index).find('t'); -}); - -$el.filter('span').filter('li'); - -$el.first().last().find('t'); - -$('div').eq(0).find('b'); - -$('#id').append("test html", "other html").find('a'); -$('#id').prepend("test html", "other html").find('a'); -$('#id').after("test html", "other html").find('a'); -$('#id').before("test html", "other html").find('a'); - -$el.remove('div').remove('a'); - -$('#id').replaceWith('some html').parent(); -$('#id').empty().parent(); - -$el.html(); -$el.html("").find('div'); - -$el.text(); -$el.text('some text'); - -$el.toArray(); -$el.clone().find('a').parent(); -$el.root().find('a'); - -$el.dom(); +/// + +import cheerio = module("cheerio"); + +var $ = cheerio.load(""); +var $el = $('selector'); +var $multiEl = $('seletor', 'selector', 'selector'); + +$el.addClass("class").addClass("test"); +$el.hasClass("test"); +$el.removeClass("class").removeClass("test"); + +$el.attr('class'); +$el.attr('class', 'test'); +$el.removeAttr("class").removeAttr("test"); + +$el.find("ul").find("> li"); + +$el.parent().parent(); +$el.next().next(); +$el.prev().prev(); +$el.siblings().siblings(); + +$el.children().children(); +$el.children("li").children("a"); + +$el.children().each((index, element) => { + return $(element).find('t'); +}); + +$el.children().map((index, element) => { + return $(element).find('t'); +}); + +$el.children().filter((index) => { + return $el.children().eq(index).find('t'); +}); + +$el.filter('span').filter('li'); + +$el.first().last().find('t'); + +$('div').eq(0).find('b'); + +$('#id').append("test html", "other html").find('a'); +$('#id').prepend("test html", "other html").find('a'); +$('#id').after("test html", "other html").find('a'); +$('#id').before("test html", "other html").find('a'); + +$el.remove('div').remove('a'); + +$('#id').replaceWith('some html').parent(); +$('#id').empty().parent(); + +$el.html(); +$el.html("").find('div'); + +$el.text(); +$el.text('some text'); + +$el.toArray(); +$el.clone().find('a').parent(); +$el.root().find('a'); + +$el.dom(); diff --git a/cheerio/cheerio.d.ts b/cheerio/cheerio.d.ts index cbf9e12da..8bb7307c0 100644 --- a/cheerio/cheerio.d.ts +++ b/cheerio/cheerio.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare interface Cheerio { +interface Cheerio { addClass(classNames: string): Cheerio; hasClass(className: string): bool; @@ -65,13 +65,13 @@ declare interface Cheerio { } -declare interface CheerioOptionsInterface { +interface CheerioOptionsInterface { ignoreWhitespace?: bool; xmlMode?: bool; lowerCaseTags?: bool; } -declare interface CheerioStatic { +interface CheerioStatic { (...selectors: any[]): Cheerio; (): Cheerio; }