Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(codepen): escape ampersand in  
Browse files Browse the repository at this point in the history
Closes #2827. Fixes #2826.

Without escaping the ampersand the   is translated into the
incorrect character.
  • Loading branch information
matthewrfindley authored and ThomasBurleson committed May 12, 2015
1 parent cae22e2 commit 0a5603f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/app/js/codepen.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
function htmlEscapeAmpersand(html) {
return html
.replace(/>/g, ">")
.replace(/ /g, " ")
.replace(/</g, "<");
}

Expand Down
9 changes: 9 additions & 0 deletions docs/spec/codepen.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ describe('CodepenDataAdapter', function() {

});

describe('when the html example includes  ', function() {

it('escapes the ampersand, so that the codepen does not translate to an invalid character', function() {
demo.files.index.contents = '<div>&nbsp;&nbsp;</div>';
data = codepenDataAdapter.translate(demo, externalScripts);
expect(angular.element(data.html).html()).toBe('&amp;nbsp;&amp;nbsp;');
});
});

describe('when the module definition in the js file is formatted in different ways', function() {

it('handles second argument on a new line', function() {
Expand Down

0 comments on commit 0a5603f

Please sign in to comment.