Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Drill openDevTools everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
smashwilson committed May 7, 2019
1 parent 7dd1fcf commit de1774c
Show file tree
Hide file tree
Showing 19 changed files with 46 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/containers/github-tab-container.js
Expand Up @@ -11,13 +11,13 @@ import BranchSet from '../models/branch-set';

export default class GitHubTabContainer extends React.Component {
static propTypes = {
workspace: PropTypes.object.isRequired,
repository: PropTypes.object,
loginModel: GithubLoginModelPropType.isRequired,
rootHolder: RefHolderPropType.isRequired,
}


// Atom environment
workspace: PropTypes.object.isRequired,
openDevTools: PropTypes.func.isRequired,
}

state = {};
Expand Down
2 changes: 2 additions & 0 deletions lib/containers/issueish-detail-container.js
Expand Up @@ -43,6 +43,7 @@ export default class IssueishDetailContainer extends React.Component {
keymaps: PropTypes.object.isRequired,
tooltips: PropTypes.object.isRequired,
config: PropTypes.object.isRequired,
openDevTools: PropTypes.func.isRequired,

// Action methods
switchToIssueish: PropTypes.func.isRequired,
Expand Down Expand Up @@ -171,6 +172,7 @@ export default class IssueishDetailContainer extends React.Component {
login={this.handleLogin}
retry={retry}
logout={this.handleLogout}
openDevTools={this.props.openDevTools}
/>
);
}
Expand Down
6 changes: 4 additions & 2 deletions lib/containers/remote-container.js
Expand Up @@ -24,16 +24,17 @@ export default class RemoteContainer extends React.Component {
remoteOperationObserver: OperationStateObserverPropType.isRequired,
pushInProgress: PropTypes.bool.isRequired,
workingDirectory: PropTypes.string,
workspace: PropTypes.object.isRequired,
remote: RemotePropType.isRequired,
remotes: RemoteSetPropType.isRequired,
branches: BranchSetPropType.isRequired,
aheadCount: PropTypes.number,

// Action methods
onPushBranch: PropTypes.func.isRequired,
}

// Atom environment
workspace: PropTypes.object.isRequired,
openDevTools: PropTypes.func.isRequired,
}

fetchToken = loginModel => {
Expand Down Expand Up @@ -102,6 +103,7 @@ export default class RemoteContainer extends React.Component {
login={this.handleLogin}
retry={retry}
logout={this.handleLogout}
openDevTools={this.props.openDevTools}
/>
);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/containers/reviews-container.js
Expand Up @@ -40,6 +40,7 @@ export default class ReviewsContainer extends React.Component {
config: PropTypes.object.isRequired,
commands: PropTypes.object.isRequired,
tooltips: PropTypes.object.isRequired,
openDevTools: PropTypes.func.isRequired,

// Action methods
reportMutationErrors: PropTypes.func.isRequired,
Expand Down Expand Up @@ -164,6 +165,7 @@ export default class ReviewsContainer extends React.Component {
login={this.handleLogin}
retry={retry}
logout={this.handleLogout}
openDevTools={this.props.openDevTools}
/>
);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/controllers/github-tab-controller.js
Expand Up @@ -8,7 +8,10 @@ import GitHubTabView from '../views/github-tab-view';

export default class GitHubTabController extends React.Component {
static propTypes = {
// Atom environment
workspace: PropTypes.object.isRequired,
openDevTools: PropTypes.func.isRequired,

repository: PropTypes.object.isRequired,
remoteOperationObserver: OperationStateObserverPropType.isRequired,
loginModel: GithubLoginModelPropType.isRequired,
Expand Down Expand Up @@ -38,6 +41,7 @@ export default class GitHubTabController extends React.Component {
return (
<GitHubTabView
workspace={this.props.workspace}
openDevTools={this.props.openDevTools}
remoteOperationObserver={this.props.remoteOperationObserver}
loginModel={this.props.loginModel}
rootHolder={this.props.rootHolder}
Expand Down
4 changes: 4 additions & 0 deletions lib/controllers/root-controller.js
Expand Up @@ -45,6 +45,7 @@ export default class RootController extends React.Component {
grammars: PropTypes.object.isRequired,
config: PropTypes.object.isRequired,
project: PropTypes.object.isRequired,
openDevTools: PropTypes.func.isRequired,
loginModel: PropTypes.object.isRequired,
confirm: PropTypes.func.isRequired,
createRepositoryForProjectPath: PropTypes.func,
Expand Down Expand Up @@ -350,6 +351,7 @@ export default class RootController extends React.Component {
repository={this.props.repository}
loginModel={this.props.loginModel}
workspace={this.props.workspace}
openDevTools={this.props.openDevTools}
/>
)}
</PaneItem>
Expand Down Expand Up @@ -440,6 +442,7 @@ export default class RootController extends React.Component {
keymaps={this.props.keymaps}
tooltips={this.props.tooltips}
config={this.props.config}
openDevTools={this.props.openDevTools}

reportMutationErrors={this.reportMutationErrors}
/>
Expand All @@ -462,6 +465,7 @@ export default class RootController extends React.Component {
tooltips={this.props.tooltips}
config={this.props.config}
commands={this.props.commandRegistry}
openDevTools={this.props.openDevTools}
reportMutationErrors={this.reportMutationErrors}
/>
)}
Expand Down
4 changes: 3 additions & 1 deletion lib/github-package.js
Expand Up @@ -31,7 +31,7 @@ const defaultState = {
export default class GithubPackage {
constructor({
workspace, project, commandRegistry, notificationManager, tooltips, styles, grammars,
keymaps, config, deserializers,
keymaps, config, deserializers, openDevTools,
confirm, getLoadSettings,
configDirPath,
renderFn, loginModel,
Expand All @@ -53,6 +53,7 @@ export default class GithubPackage {
this.styles = styles;
this.grammars = grammars;
this.keymaps = keymaps;
this.openDevTools = openDevTools;
this.configPath = path.join(configDirPath, 'github.cson');

this.styleCalculator = new StyleCalculator(this.styles, this.config);
Expand Down Expand Up @@ -281,6 +282,7 @@ export default class GithubPackage {
config={this.config}
project={this.project}
confirm={this.confirm}
openDevTools={this.openDevTools}
workdirContextPool={this.contextPool}
loginModel={this.loginModel}
repository={this.getActiveRepository()}
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Expand Up @@ -14,6 +14,7 @@ const entry = {
grammars: atom.grammars,
config: atom.config,
deserializers: atom.deserializers,
openDevTools: atom.openDevTools.bind(atom),

confirm: atom.confirm.bind(atom),
getLoadSettings: atom.getLoadSettings.bind(atom),
Expand Down
5 changes: 4 additions & 1 deletion lib/items/github-tab-item.js
Expand Up @@ -7,11 +7,14 @@ import GitHubTabContainer from '../containers/github-tab-container';

export default class GitHubTabItem extends React.Component {
static propTypes = {
workspace: PropTypes.object.isRequired,
repository: PropTypes.object,
loginModel: GithubLoginModelPropType.isRequired,

documentActiveElement: PropTypes.func,

// Atom environment
workspace: PropTypes.object.isRequired,
openDevTools: PropTypes.func.isRequired,
}

static defaultProps = {
Expand Down
1 change: 1 addition & 0 deletions lib/items/issueish-detail-item.js
Expand Up @@ -40,6 +40,7 @@ export default class IssueishDetailItem extends Component {
keymaps: PropTypes.object.isRequired,
tooltips: PropTypes.object.isRequired,
config: PropTypes.object.isRequired,
openDevTools: PropTypes.func.isRequired,

// Action methods
reportMutationErrors: PropTypes.func.isRequired,
Expand Down
1 change: 1 addition & 0 deletions lib/items/reviews-item.js
Expand Up @@ -25,6 +25,7 @@ export default class ReviewsItem extends React.Component {
config: PropTypes.object.isRequired,
commands: PropTypes.object.isRequired,
tooltips: PropTypes.object.isRequired,
openDevTools: PropTypes.func.isRequired,

// Action methods
reportMutationErrors: PropTypes.func.isRequired,
Expand Down
3 changes: 3 additions & 0 deletions lib/views/github-tab-view.js
Expand Up @@ -12,6 +12,7 @@ import RemoteContainer from '../containers/remote-container';
export default class GitHubTabView extends React.Component {
static propTypes = {
workspace: PropTypes.object.isRequired,
openDevTools: PropTypes.func.isRequired,
remoteOperationObserver: OperationStateObserverPropType.isRequired,
loginModel: GithubLoginModelPropType.isRequired,
rootHolder: RefHolderPropType.isRequired,
Expand Down Expand Up @@ -62,6 +63,8 @@ export default class GitHubTabView extends React.Component {
aheadCount={this.props.aheadCount}

onPushBranch={() => this.props.handlePushBranch(this.props.currentBranch, this.props.currentRemote)}

openDevTools={this.props.openDevTools}
/>
);
}
Expand Down
6 changes: 6 additions & 0 deletions test/containers/issueish-detail-container.test.js
Expand Up @@ -50,6 +50,7 @@ describe('IssueishDetailContainer', function() {
keymaps: atomEnv.keymaps,
tooltips: atomEnv.tooltips,
config: atomEnv.config,
openDevTools: () => {},

switchToIssueish: () => {},
onTitleChange: () => {},
Expand Down Expand Up @@ -134,8 +135,10 @@ describe('IssueishDetailContainer', function() {
});

it('renders an error view if the GraphQL query fails', async function() {
const openDevTools = sinon.spy();
const wrapper = shallow(buildApp({
endpoint: getEndpoint('github.enterprise.horse'),
openDevTools,
}));
const tokenWrapper = wrapper.find(ObserveModel).renderProp('children')({token: '1234'});

Expand Down Expand Up @@ -164,6 +167,9 @@ describe('IssueishDetailContainer', function() {
sinon.stub(loginModel, 'setToken').resolves();
await errorView.prop('login')('1234');
assert.isTrue(loginModel.setToken.calledWith('https://github.enterprise.horse', '1234'));

errorView.prop('openDevTools')();
assert.isTrue(openDevTools.called);
});

it('renders an IssueishDetailContainer with GraphQL results for an issue', async function() {
Expand Down
1 change: 1 addition & 0 deletions test/containers/remote-container.test.js
Expand Up @@ -43,6 +43,7 @@ describe('RemoteContainer', function() {
workingDirectory={__dirname}
notifications={atomEnv.notifications}
workspace={atomEnv.workspace}
openDevTools={() => {}}
remote={origin}
remotes={remotes}
branches={branches}
Expand Down
1 change: 1 addition & 0 deletions test/containers/reviews-container.test.js
Expand Up @@ -65,6 +65,7 @@ describe('ReviewsContainer', function() {
config: atomEnv.config,
commands: atomEnv.commands,
tooltips: atomEnv.tooltips,
openDevTools: () => {},
reportMutationErrors: () => {},

...override,
Expand Down
1 change: 1 addition & 0 deletions test/controllers/root-controller.test.js
Expand Up @@ -57,6 +57,7 @@ describe('RootController', function() {
config={config}
confirm={confirm}
project={project}
openDevTools={() => {}}
keymaps={atomEnv.keymaps}
loginModel={loginModel}
repository={absentRepository}
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/props/github-tab-props.js
Expand Up @@ -10,6 +10,7 @@ import {nullBranch} from '../../../lib/models/branch';
export function gitHubTabItemProps(atomEnv, repository, overrides = {}) {
return {
workspace: atomEnv.workspace,
openDevTools: () => {},
repository,
loginModel: new GithubLoginModel(InMemoryStrategy),
...overrides,
Expand All @@ -33,13 +34,15 @@ export function gitHubTabControllerProps(atomEnv, repository, overrides = {}) {
branches: new BranchSet(),
aheadCount: 0,
pushInProgress: false,
isLoading: false,
...overrides,
};
}

export function gitHubTabViewProps(atomEnv, repository, overrides = {}) {
return {
workspace: atomEnv.workspace,
openDevTools: () => {},
remoteOperationObserver: new OperationStateObserver(repository, PUSH, PULL, FETCH),
loginModel: new GithubLoginModel(InMemoryStrategy),
rootHolder: new RefHolder(),
Expand Down
1 change: 1 addition & 0 deletions test/items/issueish-detail-item.test.js
Expand Up @@ -35,6 +35,7 @@ describe('IssueishDetailItem', function() {
keymaps: atomEnv.keymaps,
tooltips: atomEnv.tooltips,
config: atomEnv.config,
openDevTools: () => {},

reportMutationErrors: () => {},
...override,
Expand Down
1 change: 1 addition & 0 deletions test/items/reviews-item.test.js
Expand Up @@ -36,6 +36,7 @@ describe('ReviewsItem', function() {
config: atomEnv.config,
commands: atomEnv.commands,
tooltips: atomEnv.tooltips,
openDevTools: () => {},
reportMutationErrors: () => {},

...override,
Expand Down

0 comments on commit de1774c

Please sign in to comment.