I'm testing jQuery terminal and I got error:
Expected '> ' to equal '> '.
when testing:
$(function() {
describe('Terminal plugin', function() {
describe('terminal create terminal destroy', function() {
var term = $('<div id="term"></div>').appendTo('body').terminal();
it('should have default prompt', function() {
var prompt = term.find('.prompt');
expect(prompt.html()).toEqual("<span>> </span>");
expect(prompt.text()).toEqual('> ');
});
});
});
});
they are same value I just copy it into console and replace to equal
by ==
or ===
and it return true
.
I'm testing jQuery terminal and I got error:
Expected '> ' to equal '> '.
when testing:
$(function() {
describe('Terminal plugin', function() {
describe('terminal create terminal destroy', function() {
var term = $('<div id="term"></div>').appendTo('body').terminal();
it('should have default prompt', function() {
var prompt = term.find('.prompt');
expect(prompt.html()).toEqual("<span>> </span>");
expect(prompt.text()).toEqual('> ');
});
});
});
});
they are same value I just copy it into console and replace to equal
by ==
or ===
and it return true
.
- 1 can you provide a plete example to reproduce? – Daniel A. White Commented Dec 25, 2015 at 16:42
1 Answer
Reset to default 13
is not a "regular" space, so "> "
and "> "
are not equivalent.
Instead, try expect(prompt.text()).toEqual('>\xA0')
, that being the hex code for a non-breaking space (it's a better idea than putting an actual non-breaking space in there!)