re-resizable
Advanced tools
Comparing version 6.4.0 to 6.5.0
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -26,16 +25,5 @@ var extendStatics = function (d, b) { | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var React = __importStar(require("react")); | ||
var resizer_1 = require("./resizer"); | ||
var fast_memoize_1 = __importDefault(require("fast-memoize")); | ||
import * as React from 'react'; | ||
import { Resizer } from './resizer'; | ||
import memoize from 'fast-memoize'; | ||
var DEFAULT_SIZE = { | ||
@@ -45,8 +33,8 @@ width: 'auto', | ||
}; | ||
var clamp = fast_memoize_1.default(function (n, min, max) { return Math.max(Math.min(n, max), min); }); | ||
var snap = fast_memoize_1.default(function (n, size) { return Math.round(n / size) * size; }); | ||
var hasDirection = fast_memoize_1.default(function (dir, target) { | ||
var clamp = memoize(function (n, min, max) { return Math.max(Math.min(n, max), min); }); | ||
var snap = memoize(function (n, size) { return Math.round(n / size) * size; }); | ||
var hasDirection = memoize(function (dir, target) { | ||
return new RegExp(dir, 'i').test(target); | ||
}); | ||
var findClosestSnap = fast_memoize_1.default(function (n, snapArray, snapGap) { | ||
var findClosestSnap = memoize(function (n, snapArray, snapGap) { | ||
if (snapGap === void 0) { snapGap = 0; } | ||
@@ -57,6 +45,6 @@ var closestGapIndex = snapArray.reduce(function (prev, curr, index) { return (Math.abs(curr - n) < Math.abs(snapArray[prev] - n) ? index : prev); }, 0); | ||
}); | ||
var endsWith = fast_memoize_1.default(function (str, searchStr) { | ||
var endsWith = memoize(function (str, searchStr) { | ||
return str.substr(str.length - searchStr.length, searchStr.length) === searchStr; | ||
}); | ||
var getStringSize = fast_memoize_1.default(function (n) { | ||
var getStringSize = memoize(function (n) { | ||
n = n.toString(); | ||
@@ -103,3 +91,3 @@ if (n === 'auto') { | ||
}; | ||
var calculateNewMax = fast_memoize_1.default(function (parentSize, innerWidth, innerHeight, maxWidth, maxHeight, minWidth, minHeight) { | ||
var calculateNewMax = memoize(function (parentSize, innerWidth, innerHeight, maxWidth, maxHeight, minWidth, minHeight) { | ||
maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth, innerHeight); | ||
@@ -696,3 +684,3 @@ maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth, innerHeight); | ||
if (enable[dir] !== false) { | ||
return (React.createElement(resizer_1.Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null)); | ||
return (React.createElement(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null)); | ||
} | ||
@@ -749,2 +737,2 @@ return null; | ||
}(React.PureComponent)); | ||
exports.Resizable = Resizable; | ||
export { Resizable }; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -38,12 +37,8 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ava_1 = __importDefault(require("ava")); | ||
var react_1 = __importDefault(require("react")); | ||
var react_dom_1 = __importDefault(require("react-dom")); | ||
var sinon_1 = __importDefault(require("sinon")); | ||
var test_utils_1 = __importDefault(require("react-dom/test-utils")); | ||
var _1 = require("./"); | ||
import test from 'ava'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import sinon from 'sinon'; | ||
import TestUtils from 'react-dom/test-utils'; | ||
import { Resizable } from './'; | ||
var screenshot = require('avaron').screenshot; | ||
@@ -62,21 +57,21 @@ var mouseMove = function (x, y) { | ||
}; | ||
ava_1.default.afterEach(function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.afterEach(function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var content; | ||
return __generator(this, function (_a) { | ||
react_dom_1.default.unmountComponentAtNode(document.body); | ||
ReactDOM.unmountComponentAtNode(document.body); | ||
content = document.querySelector('#content'); | ||
if (!content) | ||
return [2 /*return*/]; | ||
react_dom_1.default.unmountComponentAtNode(content); | ||
ReactDOM.unmountComponentAtNode(content); | ||
return [2 /*return*/]; | ||
}); | ||
}); }); | ||
ava_1.default.serial('should box width and height equal 100px', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should box width and height equal 100px', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 } })); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 } })); | ||
if (!resizable || resizable instanceof Element) { | ||
return [2 /*return*/, t.fail()]; | ||
} | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 9); | ||
@@ -89,9 +84,9 @@ t.is(divs[0].style.width, '100px'); | ||
}); }); | ||
ava_1.default.serial('should allow vh, vw relative units', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should allow vh, vw relative units', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { defaultSize: { width: '100vw', height: '100vh' } })); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { defaultSize: { width: '100vw', height: '100vh' } })); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 9); | ||
@@ -104,9 +99,9 @@ t.is(divs[0].style.width, '100vw'); | ||
}); }); | ||
ava_1.default.serial('should allow vmax, vmin relative units', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should allow vmax, vmin relative units', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { defaultSize: { width: '100vmax', height: '100vmin' } })); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { defaultSize: { width: '100vmax', height: '100vmin' } })); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 9); | ||
@@ -119,10 +114,10 @@ t.is(divs[0].style.width, '100vmax'); | ||
}); }); | ||
ava_1.default.serial('should box width and height equal auto when size omitted', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should box width and height equal auto when size omitted', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, null)); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, null)); | ||
if (!resizable || resizable instanceof Element) { | ||
return [2 /*return*/, t.fail()]; | ||
} | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 9); | ||
@@ -135,10 +130,10 @@ t.is(divs[0].style.width, 'auto'); | ||
}); }); | ||
ava_1.default.serial('should box width and height equal auto when set auto', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should box width and height equal auto when set auto', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 'auto', height: 'auto' } })); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { defaultSize: { width: 'auto', height: 'auto' } })); | ||
if (!resizable || resizable instanceof Element) { | ||
return [2 /*return*/, t.fail()]; | ||
} | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 9); | ||
@@ -151,10 +146,10 @@ t.is(divs[0].style.width, 'auto'); | ||
}); }); | ||
ava_1.default.serial('Should style is applied to box', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should style is applied to box', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { style: { position: 'absolute' } })); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { style: { position: 'absolute' } })); | ||
if (!resizable || resizable instanceof Element) { | ||
return [2 /*return*/, t.fail()]; | ||
} | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 9); | ||
@@ -165,10 +160,10 @@ t.is(divs[0].style.position, 'absolute'); | ||
}); }); | ||
ava_1.default.serial('Should custom class name be applied to box', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should custom class name be applied to box', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { className: 'custom-class-name' })); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { className: 'custom-class-name' })); | ||
if (!resizable || resizable instanceof Element) { | ||
return [2 /*return*/, t.fail()]; | ||
} | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 9); | ||
@@ -179,10 +174,10 @@ t.is(divs[0].className, 'custom-class-name'); | ||
}); }); | ||
ava_1.default.serial('Should use a custom wrapper element', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should use a custom wrapper element', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, headers; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { as: "header" })); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { as: "header" })); | ||
if (!resizable || resizable instanceof Element) { | ||
return [2 /*return*/, t.fail()]; | ||
} | ||
headers = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'header'); | ||
headers = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'header'); | ||
t.is(headers.length, 1); | ||
@@ -192,11 +187,11 @@ return [2 /*return*/]; | ||
}); }); | ||
ava_1.default.serial('Should custom class name be applied to resizer', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should custom class name be applied to resizer', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { handleClasses: { right: 'right-handle-class' } })); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { handleClasses: { right: 'right-handle-class' } })); | ||
if (!resizable || resizable instanceof Element) { | ||
return [2 /*return*/, t.fail()]; | ||
} | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[2]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[2]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
@@ -208,11 +203,11 @@ return [2 /*return*/, t.fail()]; | ||
}); }); | ||
ava_1.default.serial('Should create custom span that wraps resizable divs ', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should create custom span that wraps resizable divs ', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { handleWrapperClass: "wrapper-class" })); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { handleWrapperClass: "wrapper-class" })); | ||
if (!resizable || resizable instanceof Element) { | ||
return [2 /*return*/, t.fail()]; | ||
} | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'span'); | ||
node = react_dom_1.default.findDOMNode(divs[0]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'span'); | ||
node = ReactDOM.findDOMNode(divs[0]); | ||
t.is(node.getAttribute('class'), 'wrapper-class'); | ||
@@ -222,6 +217,6 @@ return [2 /*return*/]; | ||
}); }); | ||
ava_1.default.serial('Should not render resizer when enable props all false', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should not render resizer when enable props all false', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { enable: { | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { enable: { | ||
top: false, | ||
@@ -239,3 +234,3 @@ right: false, | ||
} | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 1); | ||
@@ -245,6 +240,6 @@ return [2 /*return*/]; | ||
}); }); | ||
ava_1.default.serial('Should render one resizer when one enable props set true', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should render one resizer when one enable props set true', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { enable: { | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { enable: { | ||
top: false, | ||
@@ -261,3 +256,3 @@ right: true, | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 2); | ||
@@ -267,6 +262,6 @@ return [2 /*return*/]; | ||
}); }); | ||
ava_1.default.serial('Should render two resizer when two enable props set true', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should render two resizer when two enable props set true', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { enable: { | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { enable: { | ||
top: true, | ||
@@ -283,3 +278,3 @@ right: true, | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 3); | ||
@@ -289,6 +284,6 @@ return [2 /*return*/]; | ||
}); }); | ||
ava_1.default.serial('Should render three resizer when three enable props set true', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should render three resizer when three enable props set true', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { enable: { | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { enable: { | ||
top: true, | ||
@@ -305,3 +300,3 @@ right: true, | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 4); | ||
@@ -311,7 +306,7 @@ return [2 /*return*/]; | ||
}); }); | ||
ava_1.default.serial('Should only right is resizable and call onResizeStart when mousedown', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should only right is resizable and call onResizeStart when mousedown', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResizeStart, resizable, divs; | ||
return __generator(this, function (_a) { | ||
onResizeStart = sinon_1.default.spy(); | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { onResizeStart: onResizeStart, enable: { | ||
onResizeStart = sinon.spy(); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { onResizeStart: onResizeStart, enable: { | ||
top: false, | ||
@@ -328,5 +323,5 @@ right: true, | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 2); | ||
test_utils_1.default.Simulate.mouseDown(react_dom_1.default.findDOMNode(divs[1])); | ||
TestUtils.Simulate.mouseDown(ReactDOM.findDOMNode(divs[1])); | ||
t.is(onResizeStart.callCount, 1); | ||
@@ -337,7 +332,7 @@ t.is(onResizeStart.getCall(0).args[1], 'right'); | ||
}); }); | ||
ava_1.default.serial('Should only bottom is resizable and call onResizeStart when mousedown', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should only bottom is resizable and call onResizeStart when mousedown', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResizeStart, resizable, divs; | ||
return __generator(this, function (_a) { | ||
onResizeStart = sinon_1.default.spy(); | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { onResizeStart: onResizeStart, enable: { | ||
onResizeStart = sinon.spy(); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { onResizeStart: onResizeStart, enable: { | ||
top: false, | ||
@@ -354,5 +349,5 @@ right: false, | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 2); | ||
test_utils_1.default.Simulate.mouseDown(react_dom_1.default.findDOMNode(divs[1])); | ||
TestUtils.Simulate.mouseDown(ReactDOM.findDOMNode(divs[1])); | ||
t.is(onResizeStart.callCount, 1); | ||
@@ -363,7 +358,7 @@ t.is(onResizeStart.getCall(0).args[1], 'bottom'); | ||
}); }); | ||
ava_1.default.serial('Should only bottomRight is resizable and call onResizeStart when mousedown', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should only bottomRight is resizable and call onResizeStart when mousedown', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResizeStart, resizable, divs; | ||
return __generator(this, function (_a) { | ||
onResizeStart = sinon_1.default.spy(); | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { onResizeStart: onResizeStart, enable: { | ||
onResizeStart = sinon.spy(); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { onResizeStart: onResizeStart, enable: { | ||
top: false, | ||
@@ -380,5 +375,5 @@ right: false, | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 2); | ||
test_utils_1.default.Simulate.mouseDown(react_dom_1.default.findDOMNode(divs[1])); | ||
TestUtils.Simulate.mouseDown(ReactDOM.findDOMNode(divs[1])); | ||
t.is(onResizeStart.callCount, 1); | ||
@@ -389,3 +384,3 @@ t.is(onResizeStart.getCall(0).args[1], 'bottomRight'); | ||
}); }); | ||
ava_1.default.serial('Should not begin resize when onResizeStart returns false', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('Should not begin resize when onResizeStart returns false', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResizeStart, onResize, resizable, divs, previousState; | ||
@@ -396,9 +391,9 @@ return __generator(this, function (_a) { | ||
}; | ||
onResize = sinon_1.default.spy(); | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { onResizeStart: onResizeStart, onResize: onResize })); | ||
onResize = sinon.spy(); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { onResizeStart: onResizeStart, onResize: onResize })); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
previousState = resizable.state.isResizing; | ||
test_utils_1.default.Simulate.mouseDown(react_dom_1.default.findDOMNode(divs[1])); | ||
TestUtils.Simulate.mouseDown(ReactDOM.findDOMNode(divs[1])); | ||
mouseMove(200, 220); | ||
@@ -410,17 +405,17 @@ t.is(onResize.callCount, 0); | ||
}); }); | ||
ava_1.default.serial('should call onResize with expected args when resize direction right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should call onResize with expected args when resize direction right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, style: { padding: '40px' } }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, style: { padding: '40px' } }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[2]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[2]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 220); | ||
test_utils_1.default.Simulate.mouseUp(node); | ||
TestUtils.Simulate.mouseUp(node); | ||
t.is(onResize.callCount, 1); | ||
@@ -435,17 +430,17 @@ t.true(onResize.getCall(0).args[0] instanceof Event); | ||
}); }); | ||
ava_1.default.serial('should call onResize with expected args when resize direction bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should call onResize with expected args when resize direction bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, style: { padding: '40px' } }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, style: { padding: '40px' } }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[3]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[3]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 220); | ||
test_utils_1.default.Simulate.mouseUp(node); | ||
TestUtils.Simulate.mouseUp(node); | ||
t.is(onResize.callCount, 1); | ||
@@ -460,17 +455,17 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should call onResize with expected args when resize direction bottomRight', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should call onResize with expected args when resize direction bottomRight', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, style: { padding: '40px' } }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, style: { padding: '40px' } }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 220); | ||
test_utils_1.default.Simulate.mouseUp(node); | ||
TestUtils.Simulate.mouseUp(node); | ||
t.is(onResize.callCount, 1); | ||
@@ -485,16 +480,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should call onResizeStop when resize stop direction right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should call onResizeStop when resize stop direction right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, style: { padding: '40px' } }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, style: { padding: '40px' } }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[2]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[2]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 220); | ||
@@ -511,16 +506,16 @@ mouseUp(200, 220); | ||
}); }); | ||
ava_1.default.serial('should call onResizeStop when resize stop direction bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should call onResizeStop when resize stop direction bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, style: { padding: '40px' } }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, style: { padding: '40px' } }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[3]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[3]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 220); | ||
@@ -537,16 +532,16 @@ mouseUp(200, 220); | ||
}); }); | ||
ava_1.default.serial('should call onResizeStop when resize stop direction bottomRight', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should call onResizeStop when resize stop direction bottomRight', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, style: { padding: '40px' } }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, style: { padding: '40px' } }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 220); | ||
@@ -562,6 +557,6 @@ mouseUp(200, 220); | ||
}); }); | ||
ava_1.default.serial('should component size updated when updateSize method called', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should component size updated when updateSize method called', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable; | ||
return __generator(this, function (_a) { | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 } }), document.getElementById('content')); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 } }), document.getElementById('content')); | ||
resizable.updateSize({ width: 200, height: 300 }); | ||
@@ -573,16 +568,16 @@ t.is(resizable.state.width, 200); | ||
}); }); | ||
ava_1.default.serial('should snapped by grid value', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should snapped by grid value', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, grid: [10, 10] }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, grid: [10, 10] }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(12, 12); | ||
@@ -596,16 +591,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should snapped by absolute snap value', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should snapped by absolute snap value', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, snap: { x: [20, 30], y: [100] } }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, snap: { x: [20, 30], y: [100] } }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(12, 12); | ||
@@ -619,16 +614,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should only snap if the gap is small enough', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should only snap if the gap is small enough', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 40, height: 40 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, grid: [40, 40], snapGap: 10 }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 40, height: 40 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, grid: [40, 40], snapGap: 10 }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 40, clientY: 40 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 40, clientY: 40 }); | ||
mouseMove(15, 15); | ||
@@ -646,16 +641,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should clamped by max width', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should clamped by max width', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, maxWidth: 200, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, maxWidth: 200, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 0); | ||
@@ -668,16 +663,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should clamped by min width', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should clamped by min width', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, minWidth: 50, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, minWidth: 50, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(-100, 0); | ||
@@ -690,16 +685,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should allow 0 as minWidth', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should allow 0 as minWidth', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, minWidth: 0, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, minWidth: 0, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(-100, 0); | ||
@@ -712,16 +707,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should clamped by max height', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should clamped by max height', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, maxHeight: 200, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, maxHeight: 200, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(0, 200); | ||
@@ -734,16 +729,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should clamped by min height', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should clamped by min height', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, minHeight: 50, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, minHeight: 50, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(0, -100); | ||
@@ -756,16 +751,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should allow 0 as minHeight', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should allow 0 as minHeight', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, minHeight: 0, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, minHeight: 0, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(0, -100); | ||
@@ -778,16 +773,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should aspect ratio locked when resize to right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should aspect ratio locked when resize to right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: true }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: true }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[2]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[2]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 0); | ||
@@ -803,16 +798,16 @@ mouseUp(200, 0); | ||
}); }); | ||
ava_1.default.serial('should aspect ratio locked with 1:1 ratio when resize to right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should aspect ratio locked with 1:1 ratio when resize to right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 1 / 1 }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 1 / 1 }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[2]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[2]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 0); | ||
@@ -828,16 +823,16 @@ mouseUp(200, 0); | ||
}); }); | ||
ava_1.default.serial('should aspect ratio locked with 2:1 ratio when resize to right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should aspect ratio locked with 2:1 ratio when resize to right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 200, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 2 / 1 }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 200, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 2 / 1 }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[2]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[2]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 0); | ||
@@ -853,16 +848,16 @@ mouseUp(200, 0); | ||
}); }); | ||
ava_1.default.serial('should aspect ratio locked with 2:1 ratio with extra width/height when resize to right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should aspect ratio locked with 2:1 ratio with extra width/height when resize to right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 250, height: 150 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 2 / 1, lockAspectRatioExtraHeight: 50, lockAspectRatioExtraWidth: 50 }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 250, height: 150 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 2 / 1, lockAspectRatioExtraHeight: 50, lockAspectRatioExtraWidth: 50 }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[2]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[2]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 0); | ||
@@ -878,16 +873,16 @@ mouseUp(200, 0); | ||
}); }); | ||
ava_1.default.serial('should aspect ratio locked when resize to bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should aspect ratio locked when resize to bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: true }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: true }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[3]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[3]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(0, 200); | ||
@@ -903,16 +898,16 @@ mouseUp(0, 200); | ||
}); }); | ||
ava_1.default.serial('should aspect ratio locked with 1:1 ratio when resize to bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should aspect ratio locked with 1:1 ratio when resize to bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 1 / 1 }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 1 / 1 }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[3]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[3]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(0, 200); | ||
@@ -928,16 +923,16 @@ mouseUp(0, 200); | ||
}); }); | ||
ava_1.default.serial('should aspect ratio locked with 2:1 ratio when resize to bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should aspect ratio locked with 2:1 ratio when resize to bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 200, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 2 / 1 }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 200, height: 100 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 2 / 1 }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[3]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[3]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(0, 200); | ||
@@ -953,16 +948,16 @@ mouseUp(0, 200); | ||
}); }); | ||
ava_1.default.serial('should aspect ratio locked with 2:1 ratio with extra width/height when resize to bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should aspect ratio locked with 2:1 ratio with extra width/height when resize to bottom', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 250, height: 150 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 2 / 1, lockAspectRatioExtraHeight: 50, lockAspectRatioExtraWidth: 50 }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 250, height: 150 }, onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop, lockAspectRatio: 2 / 1, lockAspectRatioExtraHeight: 50, lockAspectRatioExtraWidth: 50 }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[3]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[3]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(0, 200); | ||
@@ -978,16 +973,16 @@ mouseUp(0, 200); | ||
}); }); | ||
ava_1.default.serial('should clamped by parent width', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should clamped by parent width', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, bounds: "parent", onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, bounds: "parent", onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 0); | ||
@@ -1000,16 +995,16 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should clamped by parent height', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should clamped by parent height', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, onResizeStart, onResizeStop, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
onResizeStart = sinon_1.default.spy(); | ||
onResizeStop = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, bounds: "parent", onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
onResizeStart = sinon.spy(); | ||
onResizeStop = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, bounds: "parent", onResize: onResize, onResizeStart: onResizeStart, onResizeStop: onResizeStop }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(0, 200); | ||
@@ -1022,9 +1017,9 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); | ||
}); }); | ||
ava_1.default.serial('should defaultSize ignored when size set', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should defaultSize ignored when size set', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var resizable, divs; | ||
return __generator(this, function (_a) { | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, size: { width: 200, height: 300 } })); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, size: { width: 200, height: 300 } })); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
t.is(divs.length, 9); | ||
@@ -1037,11 +1032,11 @@ t.is(divs[0].style.width, '200px'); | ||
}); }); | ||
ava_1.default.serial('should render a handleComponent for right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should render a handleComponent for right', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var CustomComponent, resizable, divs, node, handleNode; | ||
return __generator(this, function (_a) { | ||
CustomComponent = react_1.default.createElement("div", { className: 'customHandle-right' }); | ||
resizable = test_utils_1.default.renderIntoDocument(react_1.default.createElement(_1.Resizable, { handleComponent: { right: CustomComponent } })); | ||
CustomComponent = React.createElement("div", { className: 'customHandle-right' }); | ||
resizable = TestUtils.renderIntoDocument(React.createElement(Resizable, { handleComponent: { right: CustomComponent } })); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[2]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[2]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
@@ -1055,16 +1050,16 @@ return [2 /*return*/, t.fail()]; | ||
}); }); | ||
ava_1.default.serial('should adjust resizing for specified scale', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
test.serial('should adjust resizing for specified scale', function (t) { return __awaiter(void 0, void 0, void 0, function () { | ||
var onResize, resizable, divs, node; | ||
return __generator(this, function (_a) { | ||
onResize = sinon_1.default.spy(); | ||
resizable = react_dom_1.default.render(react_1.default.createElement(_1.Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, style: { padding: '40px' }, scale: 0.5 }), document.getElementById('content')); | ||
onResize = sinon.spy(); | ||
resizable = ReactDOM.render(React.createElement(Resizable, { defaultSize: { width: 100, height: 100 }, onResize: onResize, style: { padding: '40px' }, scale: 0.5 }), document.getElementById('content')); | ||
if (!resizable || resizable instanceof Element) | ||
return [2 /*return*/, t.fail()]; | ||
divs = test_utils_1.default.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = react_dom_1.default.findDOMNode(divs[6]); | ||
divs = TestUtils.scryRenderedDOMComponentsWithTag(resizable, 'div'); | ||
node = ReactDOM.findDOMNode(divs[6]); | ||
if (!node || !(node instanceof HTMLDivElement)) | ||
return [2 /*return*/, t.fail()]; | ||
test_utils_1.default.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
TestUtils.Simulate.mouseDown(node, { clientX: 0, clientY: 0 }); | ||
mouseMove(200, 220); | ||
test_utils_1.default.Simulate.mouseUp(node); | ||
TestUtils.Simulate.mouseUp(node); | ||
t.is(onResize.callCount, 1); | ||
@@ -1071,0 +1066,0 @@ t.true(onResize.getCall(0).args[0] instanceof MouseEvent); |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -26,11 +25,3 @@ var extendStatics = function (d, b) { | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var React = __importStar(require("react")); | ||
import * as React from 'react'; | ||
var styles = { | ||
@@ -115,2 +106,2 @@ top: { | ||
}(React.PureComponent)); | ||
exports.Resizer = Resizer; | ||
export { Resizer }; |
{ | ||
"name": "re-resizable", | ||
"version": "6.4.0", | ||
"version": "6.5.0", | ||
"description": "Resizable component for React.", | ||
@@ -51,9 +51,9 @@ "title": "re-resizable", | ||
"@emotion/core": "10.0.22", | ||
"@storybook/addon-info": "5.3.18", | ||
"@storybook/addon-options": "5.3.18", | ||
"@storybook/react": "5.3.18", | ||
"@types/node": "12.12.38", | ||
"@storybook/addon-info": "5.3.19", | ||
"@storybook/addon-options": "5.3.19", | ||
"@storybook/react": "5.3.19", | ||
"@types/node": "12.12.47", | ||
"@types/react": "16.8.7", | ||
"@types/react-dom": "16.9.7", | ||
"@types/sinon": "9.0.0", | ||
"@types/react-dom": "16.9.8", | ||
"@types/sinon": "9.0.4", | ||
"avaron": "0.2.0", | ||
@@ -85,3 +85,3 @@ "babel-core": "7.0.0-bridge.0", | ||
"rollup-plugin-replace": "2.2.0", | ||
"rollup-plugin-typescript2": "0.27.0", | ||
"rollup-plugin-typescript2": "0.27.1", | ||
"rollup-watch": "4.3.1", | ||
@@ -93,3 +93,3 @@ "sinon": "9.0.2", | ||
"tslint-plugin-prettier": "2.3.0", | ||
"typescript": "3.8.3" | ||
"typescript": "3.9.5" | ||
}, | ||
@@ -96,0 +96,0 @@ "typings": "./lib/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
178103
2886