Skip to content

Official length workaround doesn't work #30

Description

@endash

About to dig deeper into this, but the be.of.length(x) workaround for have.length(x) no longer seems to work.

I just cloned fresh, npm installed and added a single test for

$('<div></div>').should.be.of.length(1);

And get the following failure:

TypeError: Property 'length' of object function (selector) {
    var obj = flag(this, 'object');
    if (obj instanceof $) {
      this.assert(
          obj.is(selector)
        , 'expected #{this} to be #{exp}'
        , 'expected #{this} not to be #{exp}'
        , selector
      );
    } else {
      _super.apply(this, arguments);
    }
  } is not a function
at Context.<anonymous> (file://localhost/Users/chris/dev/chai-jquery/test/chai-jquery-spec.js:604:37)
at Test.Runnable.run (file://localhost/Users/chris/dev/chai-jquery/node_modules/mocha/mocha.js:4039:32)
at Runner.runTest (file://localhost/Users/chris/dev/chai-jquery/node_modules/mocha/mocha.js:4404:10)
at file://localhost/Users/chris/dev/chai-jquery/node_modules/mocha/mocha.js:4450:12
at next (file://localhost/Users/chris/dev/chai-jquery/node_modules/mocha/mocha.js:4330:14)
at file://localhost/Users/chris/dev/chai-jquery/node_modules/mocha/mocha.js:4339:7
at next (file://localhost/Users/chris/dev/chai-jquery/node_modules/mocha/mocha.js:4287:23)
at file://localhost/Users/chris/dev/chai-jquery/node_modules/mocha/mocha.js:4307:5
at timeslice (file://localhost/Users/chris/dev/chai-jquery/node_modules/mocha/mocha.js:5279:29)

I get a different error in Safari:

'1' is not a function (evaluating 'subject.should.be.of.length(1)')

I suppose it's possible there's something wrong with my setup, but I don't see what it could be...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions