-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
36 lines (32 loc) · 1.11 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import assertElement from 'assert-element';
import componentMock from 'component-mock';
import test from 'ava';
import {Facebook, Twitter} from './';
test('facebook', () => {
const mock = componentMock(Facebook);
const el = mock.render({props: {
app_id: 123456,
class: 'SocialShare-facebook',
u: 'google.com'
}});
assertElement.isNode(el, 'a');
assertElement.hasClass(el, 'SocialShare');
assertElement.hasClass(el, 'SocialShare-facebook');
assertElement.hasAttribute(el, 'href', 'https://facebook.com/sharer.php?app_id=123456&u=google.com');
});
test('twitter', () => {
const mock = componentMock(Twitter);
const el = mock.render({props: {
class: 'SocialShare-twitter',
hashtags: ['foo', 'bar'],
in_reply_to: 'testreply',
target: '_blank',
url: 'google.com',
via: 'testvia'
}});
assertElement.isNode(el, 'a');
assertElement.hasClass(el, 'SocialShare');
assertElement.hasClass(el, 'SocialShare-twitter');
assertElement.hasAttribute(el, 'target', '_blank');
assertElement.hasAttribute(el, 'href', 'https://twitter.com/share?hashtags=foo%2Cbar&in_reply_to=testreply&url=google.com&via=testvia');
});