1
+ import React from 'react'
1
2
import { expect } from 'chai'
2
- import '../src/index.js'
3
+ const forEach = require ( 'mocha-each' )
4
+ const jsdom = require ( 'mocha-jsdom' )
5
+ import ReactTooltip from '../src/index.js'
6
+ import { render , cleanup } from '@testing-library/react'
7
+ import jss from 'jss'
8
+
9
+ afterEach ( cleanup )
3
10
4
11
describe ( 'Tooltip' , ( ) => {
5
- it ( 'COLOR GEN BASED ON PROPS // TODO' , ( ) => { // TODO: tests
6
- expect ( 2 ) . to . equal ( 2 )
7
- } )
12
+ jsdom ( { url : 'http://localhost/' } )
13
+
14
+ forEach ( [ [ { 'textColor' : 'green' , 'backgroundColor' : 'red' , 'arrowColor' : 'blue' } ]
15
+ ] ) . it ( 'Popup color generation' , ( props ) => {
16
+
17
+
18
+
19
+ //console.log(wrapper.renderer._element)
20
+
21
+
22
+ // console.log(jss)
23
+
24
+ const tooltip = render ( < ReactTooltip id = 'colorSpec' { ...props } /> )
25
+ const style = window . getComputedStyle ( document . getElementById ( 'colorSpec' ) )
26
+
27
+
28
+ // console.log(document.getElementById('colorSpec'))
29
+ // console.dir(style)
30
+
31
+
32
+ // // console.dir(document.getElementById('colorSpec').classList[0])
33
+
34
+
35
+
36
+
37
+ var cssText = "" ;
38
+
39
+
40
+ var classes = document . styleSheets [ 0 ] . rules || document . styleSheets [ 0 ] . cssRules ;
41
+ for ( var x = 0 ; x < classes . length ; x ++ ) {
42
+ // if (classes[x].selectorText == className) {
43
+ //console.dir(classes[x])
44
+ // console.dir(classes[x].selectorText)
45
+ cssText += classes [ x ] . cssText || classes [ x ] . style . cssText ;
46
+ // }
47
+ }
48
+ // console.log(cssText)
49
+
50
+
51
+ // //console.dir(window.getComputedStyle(tooltip))
52
+ } )
8
53
} )
0 commit comments