Skip to content
Permalink
Browse files

added lib folder

  • Loading branch information...
justinrhodes1 committed Nov 25, 2018
1 parent a650231 commit f0cc07440348074881b5210e25fa970c7aef5974
Showing with 944 additions and 36 deletions.
  1. +1 −2 .gitignore
  2. +35 −34 __tests__/tooltip.puppeteer.test.jsx
  3. +30 −0 lib/Tooltip/Arrow.js
  4. +319 −0 lib/Tooltip/TextBox.js
  5. +91 −0 lib/Tooltip/delayUnmount.js
  6. +295 −0 lib/Tooltip/index.js
  7. +153 −0 lib/Tooltip/style.css
  8. +20 −0 lib/index.js
@@ -1,2 +1 @@
/node_modules
/lib
/node_modules
@@ -1,43 +1,44 @@
// const puppeteer = require('puppeteer');
// const path = require('path');
const puppeteer = require('puppeteer');
const path = require('path');

it('paceholder', () => { });
// it('paceholder', () => { });

// const testURL = `${process.env.TRAVIS_BUILD_DIR}/puppeteer/index.html`;

// const testURL = path.join(__dirname, '/..');
// let browser;
// let page;
const filePath = path.join(__dirname, '/../puppeteer/index.html');
const URL = `file:///${filePath}`;
let browser;
let page;

// // Pupeteer/Chromium tests required to test computed styles &
// // those relying on clientHeight etc. This is beyond Enyzme/JSDOM.

// // Allowing enough time for puppeteer to run
// jest.setTimeout(30000);

// beforeEach(async () => {
// // both options below not needed, switching off speeds things up
// browser = await puppeteer.launch({
// headless: true,
// args: ['--no-sandbox']
// });
// page = await browser.newPage();
// await page.goto(testURL);
// });

// afterEach(async () => {
// await browser.close();
// });

// it('renders correct textbox positions for arrow positions', async () => {
// const styleTop = await page
// .$eval('.test-arrow-top .rct-textbox-container', el => el.style.top);
// const styleCenter = await page
// .$eval('.test-arrow-center .rct-textbox-container', el => el.style.top);
// const styleBottom = await page
// .$eval('.test-arrow-bottom .rct-textbox-container', el => el.style.top);

// expect(styleTop).toEqual('calc(((50% - 0px) - 24px) + 0px)');
// expect(styleCenter).toEqual('calc(50% - 72px)');
// expect(styleBottom).toEqual('calc(((50% - 144px) - -24px) + 0px)');
// });
jest.setTimeout(30000);

beforeEach(async () => {
// both options below not needed, switching off speeds things up
browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox']
});
page = await browser.newPage();
await page.goto(URL);
});

afterEach(async () => {
await browser.close();
});

it('renders correct textbox positions for arrow positions', async () => {
const styleTop = await page
.$eval('.test-arrow-top .rct-textbox-container', el => el.style.top);
const styleCenter = await page
.$eval('.test-arrow-center .rct-textbox-container', el => el.style.top);
const styleBottom = await page
.$eval('.test-arrow-bottom .rct-textbox-container', el => el.style.top);

expect(styleTop).toEqual('calc(((50% - 0px) - 24px) + 0px)');
expect(styleCenter).toEqual('calc(50% - 72px)');
expect(styleBottom).toEqual('calc(((50% - 144px) - -24px) + 0px)');
});
@@ -0,0 +1,30 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
var Arrow = function Arrow(_ref) {
var isHovered = _ref.isHovered,
hovBkg = _ref.hovBkg,
bkgCol = _ref.bkgCol,
flat = _ref.flat;
var backgroundColor = isHovered ? hovBkg : bkgCol;
var boxShadow = flat ? null : '0 0 0 1px rgba(0,0,0,.18)';
return _react.default.createElement("div", {
className: "rct-arrow",
style: {
backgroundColor: backgroundColor,
boxShadow: boxShadow
}
});
};

var _default = Arrow;
exports.default = _default;

0 comments on commit f0cc074

Please sign in to comment.
You can’t perform that action at this time.