From ee3a79f58f2ede11e5fff53c6b1663aa77d2d13a Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sun, 25 Aug 2013 19:57:14 -0500 Subject: [PATCH 1/2] Fix amplifyjs tests by including amplifyjs and jquery definition references --- amplifyjs/amplifyjs-tests.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/amplifyjs/amplifyjs-tests.ts b/amplifyjs/amplifyjs-tests.ts index 4bead9605a..c26955348b 100644 --- a/amplifyjs/amplifyjs-tests.ts +++ b/amplifyjs/amplifyjs-tests.ts @@ -1,3 +1,6 @@ +/// +/// + // Copied examples directly from AmplifyJs site // Subscribe and publish with no data From 1cbc49538e2af1d32e199ebb0fc7fff6033e088a Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sun, 25 Aug 2013 19:57:49 -0500 Subject: [PATCH 2/2] Fix chai-jquery tests --- chai-jquery/chai-jquery-tests.ts | 23 +++++++++++++++++++++++ chai/chai.d.ts | 20 +++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/chai-jquery/chai-jquery-tests.ts b/chai-jquery/chai-jquery-tests.ts index 97ed7a36a7..45c9981f5f 100644 --- a/chai-jquery/chai-jquery-tests.ts +++ b/chai-jquery/chai-jquery-tests.ts @@ -1,6 +1,8 @@ /// /// +// tests taken from https://github.com/chaijs/chai-jquery + declare var $; var expect = chai.expect; @@ -17,6 +19,7 @@ function test_css() { function test_data() { expect($('#foo')).to.have.data('toggle'); expect($('#foo')).to.have.css('toggle', 'true'); + expect($('body')).to.have.css('font-family').match(/sans-serif/); } function test_class() { @@ -59,10 +62,30 @@ function test_disabled() { expect($('#foo')).to.be.disabled; } +function test_empty() { + $('.empty').should.be.empty; + expect($('body')).not.to.be.empty; +} + +function test_exist() { + $('#exists').should.exist; + expect($('#nonexistent')).not.to.exist; +} + +function test_match_selector() { + $('input').should.match('#foo'); +} + +function test_contain() { + $('body').should.contain('text'); + expect($('#content')).to.contain('text'); +} + function test_be_selector() { expect($('#foo')).to.be(':empty'); } function test_have_selector() { + $('body').should.have('h1'); expect($('#foo')).to.have('div'); } \ No newline at end of file diff --git a/chai/chai.d.ts b/chai/chai.d.ts index 070765e00d..9d649a17c5 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -12,7 +12,25 @@ declare module chai { (target: any): Expect; } - interface Expect extends LanguageChains, NumericComparison, TypeComparison { + interface Assertions { + attr(name, value?); + css(name, value?); + data(name, value?); + class(className); + id(id); + html(html); + text(text); + value(value); + visible; + hidden; + selected; + checked; + disabled; + empty; + exist; + } + + interface Expect extends LanguageChains, NumericComparison, TypeComparison, Assertions { not: Expect; deep: Deep; a: TypeComparison;