+
+
+
-
+ );
}
+
+PushPullView.propTypes = {
+ currentBranch: BranchPropType.isRequired,
+ currentRemote: RemotePropType.isRequired,
+ isSyncing: PropTypes.bool.isRequired,
+ isFetching: PropTypes.bool.isRequired,
+ isPulling: PropTypes.bool.isRequired,
+ isPushing: PropTypes.bool.isRequired,
+ behindCount: PropTypes.number.isRequired,
+ aheadCount: PropTypes.number.isRequired,
+ push: PropTypes.func.isRequired,
+ pull: PropTypes.func.isRequired,
+ fetch: PropTypes.func.isRequired,
+ originExists: PropTypes.bool.isRequired,
+};
diff --git a/package-lock.json b/package-lock.json
index 1e52dafc56..452defce1a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1323,6 +1323,32 @@
"es6-promisify": "^5.0.0"
}
},
+ "airbnb-prop-types": {
+ "version": "2.13.2",
+ "resolved": "https://registry.npmjs.org/airbnb-prop-types/-/airbnb-prop-types-2.13.2.tgz",
+ "integrity": "sha512-2FN6DlHr6JCSxPPi25EnqGaXC4OC3/B3k1lCd6MMYrZ51/Gf/1qDfaR+JElzWa+Tl7cY2aYOlsYJGFeQyVHIeQ==",
+ "dev": true,
+ "requires": {
+ "array.prototype.find": "^2.0.4",
+ "function.prototype.name": "^1.1.0",
+ "has": "^1.0.3",
+ "is-regex": "^1.0.4",
+ "object-is": "^1.0.1",
+ "object.assign": "^4.1.0",
+ "object.entries": "^1.1.0",
+ "prop-types": "^15.7.2",
+ "prop-types-exact": "^1.2.0",
+ "react-is": "^16.8.6"
+ },
+ "dependencies": {
+ "react-is": {
+ "version": "16.8.6",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz",
+ "integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==",
+ "dev": true
+ }
+ }
+ },
"ajv": {
"version": "6.9.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.2.tgz",
@@ -2893,9 +2919,9 @@
"dev": true
},
"enzyme": {
- "version": "3.9.0",
- "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.9.0.tgz",
- "integrity": "sha512-JqxI2BRFHbmiP7/UFqvsjxTirWoM1HfeaJrmVSZ9a1EADKkZgdPcAuISPMpoUiHlac9J4dYt81MC5BBIrbJGMg==",
+ "version": "3.10.0",
+ "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.10.0.tgz",
+ "integrity": "sha512-p2yy9Y7t/PFbPoTvrWde7JIYB2ZyGC+NgTNbVEGvZ5/EyoYSr9aG/2rSbVvyNvMHEhw9/dmGUJHWtfQIEiX9pg==",
"dev": true,
"requires": {
"array.prototype.flat": "^1.2.1",
@@ -2922,30 +2948,46 @@
}
},
"enzyme-adapter-react-16": {
- "version": "1.7.1",
- "resolved": "https://registry.npmjs.org/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.7.1.tgz",
- "integrity": "sha512-OQXKgfHWyHN3sFu2nKj3mhgRcqIPIJX6aOzq5AHVFES4R9Dw/vCBZFMPyaG81g2AZ5DogVh39P3MMNUbqNLTcw==",
+ "version": "1.14.0",
+ "resolved": "https://registry.npmjs.org/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.14.0.tgz",
+ "integrity": "sha512-7PcOF7pb4hJUvjY7oAuPGpq3BmlCig3kxXGi2kFx0YzJHppqX1K8IIV9skT1IirxXlu8W7bneKi+oQ10QRnhcA==",
"dev": true,
"requires": {
- "enzyme-adapter-utils": "^1.9.0",
- "function.prototype.name": "^1.1.0",
+ "enzyme-adapter-utils": "^1.12.0",
+ "has": "^1.0.3",
"object.assign": "^4.1.0",
- "object.values": "^1.0.4",
- "prop-types": "^15.6.2",
- "react-is": "^16.6.1",
- "react-test-renderer": "^16.0.0-0"
+ "object.values": "^1.1.0",
+ "prop-types": "^15.7.2",
+ "react-is": "^16.8.6",
+ "react-test-renderer": "^16.0.0-0",
+ "semver": "^5.7.0"
+ },
+ "dependencies": {
+ "react-is": {
+ "version": "16.8.6",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz",
+ "integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==",
+ "dev": true
+ },
+ "semver": {
+ "version": "5.7.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
+ "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
+ "dev": true
+ }
}
},
"enzyme-adapter-utils": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/enzyme-adapter-utils/-/enzyme-adapter-utils-1.10.0.tgz",
- "integrity": "sha512-VnIXJDYVTzKGbdW+lgK8MQmYHJquTQZiGzu/AseCZ7eHtOMAj4Rtvk8ZRopodkfPves0EXaHkXBDkVhPa3t0jA==",
+ "version": "1.12.0",
+ "resolved": "https://registry.npmjs.org/enzyme-adapter-utils/-/enzyme-adapter-utils-1.12.0.tgz",
+ "integrity": "sha512-wkZvE0VxcFx/8ZsBw0iAbk3gR1d9hK447ebnSYBf95+r32ezBq+XDSAvRErkc4LZosgH8J7et7H7/7CtUuQfBA==",
"dev": true,
"requires": {
+ "airbnb-prop-types": "^2.13.2",
"function.prototype.name": "^1.1.0",
"object.assign": "^4.1.0",
"object.fromentries": "^2.0.0",
- "prop-types": "^15.6.2",
+ "prop-types": "^15.7.2",
"semver": "^5.6.0"
},
"dependencies": {
@@ -4113,9 +4155,9 @@
},
"dependencies": {
"readable-stream": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz",
- "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==",
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz",
+ "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==",
"dev": true,
"requires": {
"inherits": "^2.0.3",
@@ -6593,6 +6635,17 @@
"react-is": "^16.8.1"
}
},
+ "prop-types-exact": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/prop-types-exact/-/prop-types-exact-1.2.0.tgz",
+ "integrity": "sha512-K+Tk3Kd9V0odiXFP9fwDHUYRyvK3Nun3GVyPapSIs5OBkITAm15W0CPFD/YKTkMUAbc0b9CUwRQp2ybiBIq+eA==",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.3",
+ "object.assign": "^4.1.0",
+ "reflect.ownkeys": "^0.2.0"
+ }
+ },
"prr": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@@ -6754,15 +6807,23 @@
}
},
"react-test-renderer": {
- "version": "16.8.3",
- "resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-16.8.3.tgz",
- "integrity": "sha512-rjJGYebduKNZH0k1bUivVrRLX04JfIQ0FKJLPK10TAb06XWhfi4gTobooF9K/DEFNW98iGac3OSxkfIJUN9Mdg==",
+ "version": "16.8.6",
+ "resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-16.8.6.tgz",
+ "integrity": "sha512-H2srzU5IWYT6cZXof6AhUcx/wEyJddQ8l7cLM/F7gDXYyPr4oq+vCIxJYXVGhId1J706sqziAjuOEjyNkfgoEw==",
"dev": true,
"requires": {
"object-assign": "^4.1.1",
"prop-types": "^15.6.2",
- "react-is": "^16.8.3",
- "scheduler": "^0.13.3"
+ "react-is": "^16.8.6",
+ "scheduler": "^0.13.6"
+ },
+ "dependencies": {
+ "react-is": {
+ "version": "16.8.6",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz",
+ "integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==",
+ "dev": true
+ }
}
},
"read-pkg": {
@@ -6848,6 +6909,12 @@
}
}
},
+ "reflect.ownkeys": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz",
+ "integrity": "sha1-dJrO7H8/34tj+SegSAnpDFwLNGA=",
+ "dev": true
+ },
"regenerate": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz",
@@ -7389,9 +7456,9 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"scheduler": {
- "version": "0.13.3",
- "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.13.3.tgz",
- "integrity": "sha512-UxN5QRYWtpR1egNWzJcVLk8jlegxAugswQc984lD3kU7NuobsO37/sRfbpTdBjtnD5TBNFA2Q2oLV5+UmPSmEQ==",
+ "version": "0.13.6",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.13.6.tgz",
+ "integrity": "sha512-IWnObHt413ucAYKsD9J1QShUKkbKLQQHdxRyw73sw4FN26iWr3DY/H34xGPe4nmL1DwXyWmSWmMrA9TfQbE/XQ==",
"dev": true,
"requires": {
"loose-envify": "^1.1.0",
diff --git a/package.json b/package.json
index 19433440b0..630e81f015 100644
--- a/package.json
+++ b/package.json
@@ -89,8 +89,8 @@
"electron-devtools-installer": "2.2.4",
"electron-link": "0.3.2",
"electron-mksnapshot": "~2.0",
- "enzyme": "3.9.0",
- "enzyme-adapter-react-16": "1.7.1",
+ "enzyme": "3.10.0",
+ "enzyme-adapter-react-16": "1.14.0",
"eslint": "5.16.0",
"eslint-config-fbjs-opensource": "1.0.0",
"eslint-plugin-jsx-a11y": "6.2.1",
diff --git a/test/atom/octicon.test.js b/test/atom/octicon.test.js
new file mode 100644
index 0000000000..01f2807d07
--- /dev/null
+++ b/test/atom/octicon.test.js
@@ -0,0 +1,27 @@
+import React from 'react';
+import {shallow} from 'enzyme';
+
+import Octicon from '../../lib/atom/octicon';
+
+describe('Octicon', function() {
+ it('adds the boilerplate to render an octicon', function() {
+ const wrapper = shallow(
);
+ const span = wrapper.find('span');
+ assert.isTrue(span.hasClass('icon'));
+ assert.isTrue(span.hasClass('icon-check'));
+ });
+
+ it('appends additional CSS classes', function() {
+ const wrapper = shallow(
);
+ const span = wrapper.find('span');
+ assert.isTrue(span.hasClass('icon'));
+ assert.isTrue(span.hasClass('icon-alert'));
+ assert.isTrue(span.hasClass('github-Octicon-extra'));
+ });
+
+ it('passes additional props directly to the span', function() {
+ const wrapper = shallow(
);
+ const span = wrapper.find('span');
+ assert.strictEqual(span.prop('extra'), 'yes');
+ });
+});
diff --git a/test/atom/tooltip.test.js b/test/atom/tooltip.test.js
new file mode 100644
index 0000000000..1e4f8542b3
--- /dev/null
+++ b/test/atom/tooltip.test.js
@@ -0,0 +1,78 @@
+import React from 'react';
+import {shallow} from 'enzyme';
+import {Disposable} from 'event-kit';
+
+import Tooltip from '../../lib/atom/tooltip';
+import RefHolder from '../../lib/models/ref-holder';
+import {injectAtomEnv} from '../../lib/context/atom';
+
+describe('Tooltip', function() {
+ let atomEnv;
+
+ beforeEach(function() {
+ atomEnv = global.buildAtomEnvironment();
+ injectAtomEnv(atomEnv);
+
+ sinon.stub(atomEnv.tooltips, 'add').callsFake(() => new Disposable());
+ });
+
+ afterEach(function() {
+ atomEnv.destroy();
+ });
+
+ function buildApp(...override) {
+ const props = {
+ target: new RefHolder(),
+ ...override,
+ };
+
+ return
;
+ }
+
+ describe('without children', function() {
+ it('passes verbatim props directly to the Atom API', function() {
+ const targetElement = document.createElement('div');
+ const targetHolder = new RefHolder();
+ const keyBindingTarget = document.createElement('div');
+
+ const wrapper = shallow(buildApp({
+ target: targetHolder,
+ title: 'the title',
+ html: true,
+ placement: 'top',
+ trigger: 'manual',
+ keyBindingCommand: 'github:commit',
+ keyBindingTarget,
+ }));
+ assert.isTrue(wrapper.isEmptyRender());
+ assert.isFalse(atomEnv.tooltips.add.called);
+
+ targetHolder.setter(targetElement);
+
+ assert.isTrue(atomEnv.tooltips.add.calledWith(targetElement, {
+ title: 'the title',
+ html: true,
+ placement: 'top',
+ trigger: 'manual',
+ keyBindingCommand: 'github:commit',
+ keyBindingTarget,
+ }));
+ });
+
+ it('passes className as class');
+
+ it('defaults hover tooltip delays');
+
+ it('defaults non-hover tooltip delays to zero');
+
+ it('destroys and re-creates the tooltip when rendered with a differing option');
+
+ it('does not destroy and re-create the tooltip when no props have changed');
+
+ it('destroys the tooltip when unmounted');
+ });
+
+ describe('with children', function() {
+ //
+ });
+});