Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
0c6d9e79
Commit
0c6d9e79
authored
Jul 25, 2017
by
Steel Wagstaff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add media-embedder tests for .mp3, .ogg, .wav files
Added media-embedder tests for .mp3, .ogg, .wav files
parent
ddae87a9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
3 deletions
+38
-3
media-embedder-test.js
src/sidebar/test/media-embedder-test.js
+38
-3
No files found.
src/sidebar/test/media-embedder-test.js
View file @
0c6d9e79
...
@@ -107,7 +107,42 @@ describe('media-embedder', function () {
...
@@ -107,7 +107,42 @@ describe('media-embedder', function () {
element
.
children
[
0
].
src
,
'https://archive.org/download/testmp3testfile/mpthreetest.mp3'
);
//not sure if this is correct
element
.
children
[
0
].
src
,
'https://archive.org/download/testmp3testfile/mpthreetest.mp3'
);
//not sure if this is correct
});
});
});
});
})
it
(
'replaces ogg links with html5 audio elements'
,
function
()
{
var
urls
=
[
'https://www.w3schools.com/html/horse.ogg'
,
'https://www.w3schools.com/html/horse.ogg#fragment'
,
'https://www.w3schools.com/html/horse.ogg?q=foo&id=bar'
,
];
urls
.
forEach
(
function
(
url
)
{
var
element
=
domElement
(
'<a href="'
+
url
+
'">'
+
url
+
'</a>'
);
mediaEmbedder
.
replaceLinksWithEmbeds
(
element
);
assert
.
equal
(
element
.
childElementCount
,
1
);
assert
.
equal
(
element
.
children
[
0
].
tagName
,
'AUDIO'
);
assert
.
equal
(
element
.
children
[
0
].
src
,
'https://www.w3schools.com/html/horse.ogg'
);
//not sure if this is correct
});
});
it
(
'replaces wav links with html5 audio elements'
,
function
()
{
var
urls
=
[
'http://freewavesamples.com/files/Kurzweil-K2000-Dual-Bass-C1.wav'
,
'http://freewavesamples.com/files/Kurzweil-K2000-Dual-Bass-C1.wav#fragment'
,
'http://freewavesamples.com/files/Kurzweil-K2000-Dual-Bass-C1.wav?q=foo&id=bar'
,
];
urls
.
forEach
(
function
(
url
)
{
var
element
=
domElement
(
'<a href="'
+
url
+
'">'
+
url
+
'</a>'
);
mediaEmbedder
.
replaceLinksWithEmbeds
(
element
);
assert
.
equal
(
element
.
childElementCount
,
1
);
assert
.
equal
(
element
.
children
[
0
].
tagName
,
'AUDIO'
);
assert
.
equal
(
element
.
children
[
0
].
src
,
'http://freewavesamples.com/files/Kurzweil-K2000-Dual-Bass-C1.wav'
);
//not sure if this is correct
});
});
it
(
'does not replace links if the link text is different'
,
function
()
{
it
(
'does not replace links if the link text is different'
,
function
()
{
var
url
=
'https://youtu.be/QCkm0lL-6lc'
;
var
url
=
'https://youtu.be/QCkm0lL-6lc'
;
...
@@ -162,4 +197,4 @@ describe('media-embedder', function () {
...
@@ -162,4 +197,4 @@ describe('media-embedder', function () {
assert
.
equal
(
assert
.
equal
(
element
.
children
[
1
].
src
,
'https://www.youtube.com/embed/abcdefg'
);
element
.
children
[
1
].
src
,
'https://www.youtube.com/embed/abcdefg'
);
});
});
};
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment