From 126de40bb4aedbb89ba378c23cdda51dee723bb8 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Wed, 15 Apr 2015 11:44:05 -0400 Subject: [PATCH] add $expect --- README.md | 3 ++- lib/jasmine-jquery.js | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fe1069c6..9729c81a 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # jasmine-jquery [![Build Status](https://travis-ci.org/velesin/jasmine-jquery.png)](https://travis-ci.org/velesin/jasmine-jquery) -jasmine-jquery provides two extensions for the [Jasmine](http://jasmine.github.io/) JavaScript Testing Framework: +jasmine-jquery provides three extensions for the [Jasmine](http://jasmine.github.io/) JavaScript Testing Framework: - a set of custom matchers for jQuery framework - an API for handling HTML, CSS, and JSON fixtures in your specs +- the function `$expect(selector)`, which is a simple shortcut for `expect( $( selector ) )`. ## Installation diff --git a/lib/jasmine-jquery.js b/lib/jasmine-jquery.js index 44953412..c8d56da4 100644 --- a/lib/jasmine-jquery.js +++ b/lib/jasmine-jquery.js @@ -829,4 +829,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. window.getJSONFixture = function (url) { return jasmine.getJSONFixtures().proxyCallTo_('read', arguments)[url] } + + window.$expect = function( selector ) { + return window.expect( $(selector) ) + } + }(window, window.jasmine, window.jQuery);