8
0
Просмотр исходного кода

MediaRegistry#_getMedia is protected now. Added a test case for #26.

Kamil Piechaczek 7 лет назад
Родитель
Сommit
faf3a29c07

+ 1 - 1
packages/ckeditor5-media-embed/src/mediaregistry.js

@@ -102,7 +102,7 @@ export default class MediaRegistry {
 	/**
 	 * Returns a `Media` instance for the given URL.
 	 *
-	 * @private
+	 * @protected
 	 * @param {String} url The url of the media.
 	 * @returns {module:media-embed/mediaregistry~Media|null} The `Media` instance or `null` when there's none.
 	 */

+ 25 - 12
packages/ckeditor5-media-embed/tests/mediaembedediting.js

@@ -201,23 +201,36 @@ describe( 'MediaEmbedEditing', () => {
 
 						it( 'upcasts the URL (youtube)', () => {
 							testMediaUpcast( [
-								'https://www.youtube.com/watch?v=f-oo',
-								'www.youtube.com/watch?v=f-oo',
-								'youtube.com/watch?v=f-oo',
+								'https://www.youtube.com/watch?v=foo',
+								'www.youtube.com/watch?v=foo',
+								'youtube.com/watch?v=foo',
 
-								'https://www.youtube.com/v/f-oo',
-								'www.youtube.com/v/f-oo',
-								'youtube.com/v/f-oo',
+								'https://www.youtube.com/v/foo',
+								'www.youtube.com/v/foo',
+								'youtube.com/v/foo',
 
-								'https://www.youtube.com/embed/f-oo',
-								'www.youtube.com/embed/f-oo',
-								'youtube.com/embed/f-oo',
+								'https://www.youtube.com/embed/foo',
+								'www.youtube.com/embed/foo',
+								'youtube.com/embed/foo',
 
-								'https://youtu.be/f-oo',
-								'youtu.be/f-oo'
+								'https://youtu.be/foo',
+								'youtu.be/foo'
 							],
 							'<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;">' +
-								'<iframe src="https://www.youtube.com/embed/f-oo" ' +
+								'<iframe src="https://www.youtube.com/embed/foo" ' +
+									'style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" ' +
+									'frameborder="0" allow="autoplay; encrypted-media" allowfullscreen="">' +
+								'</iframe>' +
+							'</div>' );
+						} );
+
+						// See: https://github.com/ckeditor/ckeditor5-media-embed/issues/26
+						it( 'upcasts the URL that contains a dash (youtube)', () => {
+							testMediaUpcast( [
+								'https://www.youtube.com/watch?v=euqbMkM-QQk'
+							],
+							'<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;">' +
+								'<iframe src="https://www.youtube.com/embed/euqbMkM-QQk" ' +
 									'style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" ' +
 									'frameborder="0" allow="autoplay; encrypted-media" allowfullscreen="">' +
 								'</iframe>' +