bessdsv / karma-jasmine-jquery

Jasmine-jquery plugin for Jasmine in Karma
Other
18 stars 55 forks source link

Jasmine expects with CSS selectors failing #6

Open crispydc opened 9 years ago

crispydc commented 9 years ago

Hi,

I'm trying to get karma-jasmine-jquery working on a new project and I'm having some trouble - I'm not sure where the issue is. I am using karma-jasmine version 0.3.5, jasmine-core 2.2.0, and karma-jasmine-jquery 0.1.1. When I try to run this test:

describe("experimentation", function() {
  var elem;
  beforeEach(function() {
  elem = $('<div id="container"><p>Hello World</p></div>');
  });
  it("allows us to serach with Css selectors", function() {
   expect(elem).toBe('#container');
   expect(elem).toContainElement('p');
    expect(elem).toEqual('#container');
   expect(elem).toEqual('p')
  });
 });

and I get the following errors:

experimentation
    ✗ allows us to serach with Css selectors
    Expected ({ 0: HTMLNode, length: 1 }) to be '#container'.
        at /var/folders/zg/yn1mt9m55w385c2k_jkyd9_5xztm6l/T/dda6e3ae7d9f204ac6ce90332d2945ef.browserify:4211

    Expected ({ 0: HTMLNode, length: 1 }) to equal '#container'.
        at /var/folders/zg/yn1mt9m55w385c2k_jkyd9_5xztm6l/T/dda6e3ae7d9f204ac6ce90332d2945ef.browserify:4213

    Expected ({ 0: HTMLNode, length: 1 }) to equal 'p'.
        at /var/folders/zg/yn1mt9m55w385c2k_jkyd9_5xztm6l/T/dda6e3ae7d9f204ac6ce90332d2945ef.browserify:4214

Is there a version conflict that I'm not seeing? I know that jasmine-jquery is loaded because I can load fixtures without any issues and the method toContainElement works fine. It seems that only the jQuery selectors are affected.

Not sure if the issue lies with this library, one of the jasmine libraries, or (most likely) something I'm doing wrong. Any help you could provide would be much appreciated. Thanks!