kb_video_embeding.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. QUnit.test('kb video url parsing and converting to embeding url', assert => {
  2. var klass = App.UiElement.richtext.additions.RichTextToolPopupVideo;
  3. var parsed = klass.detectProviderAndId('https://www.youtube.com/watch?v=vTTzwJsHpU8')
  4. assert.equal(parsed[0], 'youtube')
  5. assert.equal(parsed[1], 'vTTzwJsHpU8')
  6. var parsed = klass.detectProviderAndId('https://www.youtube.com/watch?v=vTTzwJsHpU8&other=true')
  7. assert.equal(parsed[0], 'youtube')
  8. assert.equal(parsed[1], 'vTTzwJsHpU8')
  9. var parsed = klass.detectProviderAndId('https://www.youtube.com/watch?v=vTTzwJsHpU8#hashtag')
  10. assert.equal(parsed[0], 'youtube')
  11. assert.equal(parsed[1], 'vTTzwJsHpU8')
  12. var parsed = klass.detectProviderAndId('https://www.youtube.com/watch?v=_EYF1-2uiIg')
  13. assert.equal(parsed[0], 'youtube')
  14. assert.equal(parsed[1], '_EYF1-2uiIg')
  15. var parsed = klass.detectProviderAndId('https://www.youtu.be/vTTzwJsHpU8')
  16. assert.equal(parsed[0], 'youtube')
  17. assert.equal(parsed[1], 'vTTzwJsHpU8')
  18. var parsed = klass.detectProviderAndId('https://www.youtube.com/embed/vTTzwJsHpU8')
  19. assert.equal(parsed[0], 'youtube')
  20. assert.equal(parsed[1], 'vTTzwJsHpU8')
  21. var parsed = klass.detectProviderAndId('https://www.vimeo.com/358296442')
  22. assert.equal(parsed[0], 'vimeo')
  23. assert.equal(parsed[1], '358296442')
  24. })