Skip to content

Commit ad19add

Browse files
committed
Tests - In Progress - Attempting Popup Colors CSS Checks
1 parent a4fe58d commit ad19add

File tree

1 file changed

+49
-4
lines changed

1 file changed

+49
-4
lines changed

test/index.spec.js

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,53 @@
1+
import React from 'react'
12
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)
310

411
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+
})
853
})

0 commit comments

Comments
 (0)