Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError when comparing two objects with eql #139

Open
l0b0 opened this issue Jul 2, 2015 · 0 comments
Open

RangeError when comparing two objects with eql #139

l0b0 opened this issue Jul 2, 2015 · 0 comments

Comments

@l0b0
Copy link

l0b0 commented Jul 2, 2015

I'd like to use eql to compare two objects:

expect(tokenizeTagText(text)).to.eql([new TextField('only text field')]);

But I get this using mocha:

RangeError: Maximum call stack size exceeded

However, if I change the test to use equal, they look the same:

Error: expected [ { name: 'only text field',
markup: { '0': <input value="only text field">, length: 1 } } ] to equal [ { name: 'only text field',
markup: { '0': <input value="only text field">, length: 1 } } ]

It seems the RangeError comes from expect.js.

It seems the issue is with comparing jQuery elements:

it('failing', function () {
    expect([ { name: 'only text field',
            markup: { '0': $('<input value="only text field">'), length: 1 } } ]).to.eql([ { name: 'only text field',
            markup: { '0': $('<input value="only text field">'), length: 1 } } ]);
});
it('successful', function () {
    expect([ { name: 'only text field',
            markup: { '0': '<input value="only text field">', length: 1 } } ]).to.eql([ { name: 'only text field',
            markup: { '0': '<input value="only text field">', length: 1 } } ]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant