This repository has been archived by the owner on Apr 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2439 from magento-trigger/team3-delivery
[Team 3] Bugfixes
- Loading branch information
Showing
17 changed files
with
197 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
dev/tests/js/jasmine/tests/lib/mage/wysiwygAdapter.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
/* eslint-disable max-nested-callbacks */ | ||
define([ | ||
'wysiwygAdapter' | ||
], function (wysiwygAdapter) { | ||
'use strict'; | ||
|
||
var obj; | ||
|
||
beforeEach(function () { | ||
|
||
/** | ||
* Dummy constructor to use for instantiation | ||
* @constructor | ||
*/ | ||
var Constr = function () {}; | ||
|
||
Constr.prototype = wysiwygAdapter; | ||
|
||
obj = new Constr(); | ||
obj.initialize('id', { | ||
'directives_url': 'http://example.com/admin/cms/wysiwyg/directive/' | ||
}); | ||
}); | ||
|
||
describe('wysiwygAdapter', function () { | ||
var decodedHtml = '<p>' + | ||
'<img src="{{media url="wysiwyg/banana.jpg"}}" alt="" width="612" height="459"></p>', | ||
encodedHtml = '<p>' + | ||
'<img src="http://example.com/admin/cms/wysiwyg/directive/' + | ||
'___directive/e3ttZWRpYSB1cmw9Ind5c2l3eWcvYmFuYW5hLmpwZyJ9fQ%2C%2C" alt="" width="612" height="459">' + | ||
'</p>', | ||
encodedHtmlWithForwardSlashInImgSrc = encodedHtml.replace('%2C%2C', '%2C%2C/'); | ||
|
||
describe('"encodeDirectives" method', function () { | ||
it('converts media directive img src to directive URL', function () { | ||
expect(obj.encodeDirectives(decodedHtml)).toEqual(encodedHtml); | ||
}); | ||
}); | ||
|
||
describe('"decodeDirectives" method', function () { | ||
it( | ||
'converts directive URL img src without a trailing forward slash ' + | ||
'to media url without a trailing forward slash', | ||
function () { | ||
expect(obj.decodeDirectives(encodedHtml)).toEqual(decodedHtml); | ||
} | ||
); | ||
|
||
it('converts directive URL img src with a trailing forward slash ' + | ||
'to media url without a trailing forward slash', | ||
function () { | ||
expect(obj.decodeDirectives(encodedHtmlWithForwardSlashInImgSrc)).toEqual(decodedHtml); | ||
} | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters