Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

Tests for createlink bugs #190

Merged
merged 8 commits into from
Jun 13, 2014
Merged
17 changes: 17 additions & 0 deletions test/commands.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,4 +400,21 @@ describe('commands', function () {
});
});
});

describe('createlink', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command name should be camelcased.

given('an empty editor', function () {
when('the command is executed', function () {
beforeEach(function () {
scribeNode.click();
executeCommand('createlink', 'http://example.com');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command name should be camelcased.

});

it('should insert A with specified URL and content followed by BR', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“followed by BR” probably isn't what you want to test here. We have <firefox-bogus-br>/<chrome-bogus-br>/<bogus-br> elements you can use to define where you expect browsers to insert bogus BR elements (because they are not consistent), however I don't think it should be in the test description.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking for something that would just check for existence of A. Is there any helper like that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way you’ve done it is probably how I would do it (without parsing the DOM and looking for child nodes, etc. – seems a bit pointless).

return scribeNode.getInnerHTML().then(function (innerHTML) {
expect(innerHTML).to.have.html('<p><a href="http://example.com">http://example.com</a><br></p>');
});
});
});
});
});
});