embeds
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -35,2 +35,6 @@ 'use strict'; | ||
var _spotify = require('./spotify'); | ||
var spotify = _interopRequireWildcard(_spotify); | ||
var _custom = require('./custom'); | ||
@@ -53,3 +57,3 @@ | ||
var types = { | ||
image: image, video: video, youtube: youtube, twitter: twitter, instagram: instagram, facebook: facebook, vine: vine, | ||
image: image, video: video, youtube: youtube, twitter: twitter, instagram: instagram, facebook: facebook, vine: vine, spotify: spotify, | ||
custom: custom /* last element */ | ||
@@ -56,0 +60,0 @@ }; |
@@ -8,2 +8,3 @@ import * as image from './image'; | ||
import * as vine from './vine'; | ||
import * as spotify from './spotify'; | ||
import * as custom from './custom'; | ||
@@ -14,3 +15,3 @@ import assert from 'assert'; | ||
const types = { | ||
image, video, youtube, twitter, instagram, facebook, vine, | ||
image, video, youtube, twitter, instagram, facebook, vine, spotify, | ||
custom /* last element */ | ||
@@ -17,0 +18,0 @@ }; |
{ | ||
"name": "embeds", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Parse & render embeds", | ||
@@ -45,3 +45,3 @@ "main": "dist/index.js", | ||
"semistandard-deku": "micnews/semistandard#deku", | ||
"snazzy": "^3.0.0", | ||
"snazzy": "^4.0.0", | ||
"tape-catch": "^1.0.4", | ||
@@ -48,0 +48,0 @@ "testron": "^1.2.0", |
@@ -432,2 +432,35 @@ import test from './tape-wrapper'; | ||
test('parse() spotify', t => { | ||
const input = '<iframe src="https://embed.spotify.com/?uri=spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf" width="300" height="380" frameborder="0" allowtransparency="true"></iframe>'; | ||
const actual = parse(input); | ||
const expected = { | ||
type: 'spotify', | ||
url: 'https://embed.spotify.com/?uri=spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf', | ||
spotifyUri: 'spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf', | ||
width: 300, | ||
height: 380 | ||
}; | ||
t.deepEqual(actual, expected); | ||
}); | ||
test('parse() spotify no size', t => { | ||
const input = '<iframe src="https://embed.spotify.com/?uri=spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf"></iframe>'; | ||
const actual = parse(input); | ||
const expected = { | ||
type: 'spotify', | ||
url: 'https://embed.spotify.com/?uri=spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf', | ||
spotifyUri: 'spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf', | ||
width: 300, | ||
height: 80 | ||
}; | ||
t.deepEqual(actual, expected); | ||
}); | ||
test('parse() spotify no uri', t => { | ||
const input = '<iframe src="https://embed.spotify.com/abc"></iframe>'; | ||
const actual = parse(input); | ||
const expected = null; | ||
t.deepEqual(actual, expected); | ||
}); | ||
test('parse() iframe no src', t => { | ||
@@ -434,0 +467,0 @@ const input = '<iframe class="embedly-embed" width="600" height="600" scrolling="no" frameborder="0" allowfullscreen=""></iframe>'; |
@@ -293,2 +293,26 @@ import test from './tape-wrapper'; | ||
test('render() spotify, custom size', t => { | ||
const input = { | ||
spotifyUri: 'spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf', | ||
type: 'spotify', | ||
url: 'https://embed.spotify.com/?uri=spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf', | ||
width: 400, | ||
height: 300 | ||
}; | ||
const actual = render(input); | ||
const expected = '<iframe src="https://embed.spotify.com/?uri=spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf" width="100%" height="300" frameborder="0"></iframe>'; | ||
t.is(actual, expected); | ||
}); | ||
test('render() spotify, default size', t => { | ||
const input = { | ||
spotifyUri: 'spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf', | ||
type: 'spotify', | ||
url: 'https://embed.spotify.com/?uri=spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf' | ||
}; | ||
const actual = render(input); | ||
const expected = '<iframe src="https://embed.spotify.com/?uri=spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf" width="100%" height="80" frameborder="0"></iframe>'; | ||
t.is(actual, expected); | ||
}); | ||
test('renderText()', t => { | ||
@@ -295,0 +319,0 @@ t.deepEqual(renderText(undefined), []); |
112049
58
2751