-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5448482
commit 6b12726
Showing
1 changed file
with
11 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,17 +182,17 @@ describe('TinyMceEditor hooks', () => { | |
}); | ||
|
||
describe('replaceStaticWithAsset', () => { | ||
const initialContent = '<img src="/static/soMEImagEURl1.jpeg"/><a href="/assets/v1/some-key/test.pdf">test</a>'; | ||
const learningContextId = 'course+test+run'; | ||
const initialContent = '<img src="/static/soMEImagEURl1.jpeg"/><a href="/assets/v1/some-key/test.pdf">test</a><img src="/asset-v1:org+test+run+type@[email protected]" />'; | ||
const learningContextId = 'course-v1:org+test+run'; | ||
const lmsEndpointUrl = 'sOmEvaLue.cOm'; | ||
it('it returns updated src for text editor to update content', () => { | ||
const expected = '<img src="/asset+test+run+type@[email protected]"/><a href="/asset+test+run+type@[email protected]">test</a>'; | ||
it('returns updated src for text editor to update content', () => { | ||
const expected = '<img src="/asset-v1:org+test+run+type@[email protected]"/><a href="/asset-v1:org+test+run+type@[email protected]">test</a><img src="/asset-v1:org+test+run+type@[email protected]" />'; | ||
const actual = module.replaceStaticWithAsset({ initialContent, learningContextId }); | ||
expect(actual).toEqual(expected); | ||
}); | ||
it('it returs updated src with absolute url for expandable editor to update content', () => { | ||
it('returns updated src with absolute url for expandable editor to update content', () => { | ||
const editorType = 'expandable'; | ||
const expected = `<img src="${lmsEndpointUrl}/asset+test+run+type@[email protected]"/><a href="${lmsEndpointUrl}/asset+test+run+type@[email protected]">test</a>`; | ||
const expected = `<img src="${lmsEndpointUrl}/asset-v1:org+test+run+type@[email protected]"/><a href="${lmsEndpointUrl}/asset-v1:org+test+run+type@[email protected]">test</a><img src="${lmsEndpointUrl}/asset-v1:org+test+run+type@[email protected]" />`; | ||
const actual = module.replaceStaticWithAsset({ | ||
initialContent, | ||
editorType, | ||
|
@@ -201,6 +201,11 @@ describe('TinyMceEditor hooks', () => { | |
}); | ||
expect(actual).toEqual(expected); | ||
}); | ||
it('returns false when there are no srcs to update', () => { | ||
const content = '<div>Hello world!</div>'; | ||
const actual = module.replaceStaticWithAsset({ initialContent: content, learningContextId }); | ||
expect(actual).toBeFalsy(); | ||
}); | ||
}); | ||
describe('setAssetToStaticUrl', () => { | ||
it('returns content with updated img links', () => { | ||
|