*/
import { shallow } from 'enzyme';
import * as React from 'react';
-import { mockBranch, mockMainBranch } from '../../../../../helpers/mocks/branch-like';
+import {
+ mockBranch,
+ mockMainBranch,
+ mockPullRequest
+} from '../../../../../helpers/mocks/branch-like';
import { ComponentNavMenu } from '../ComponentNavMenu';
const mainBranch = mockMainBranch();
);
});
+it('should work for pull requests', () => {
+ [true, false].forEach(showSettings =>
+ expect(
+ shallow(
+ <ComponentNavMenu
+ appState={{ branchesEnabled: true }}
+ branchLike={mockPullRequest()}
+ component={{
+ ...baseComponent,
+ configuration: { showSettings },
+ extensions: [{ key: 'component-foo', name: 'ComponentFoo' }]
+ }}
+ />
+ )
+ ).toMatchSnapshot()
+ );
+});
+
it('should work for all qualifiers', () => {
['TRK', 'VW', 'SVW', 'APP'].forEach(checkWithQualifier);
expect.assertions(4);
project_activity.page
</Link>
</li>
+ <Dropdown
+ data-test="administration"
+ overlay={
+ <ul
+ className="menu"
+ >
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/project/settings",
+ "query": Object {
+ "branch": "release",
+ "id": "foo",
+ },
+ }
+ }
+ >
+ project_settings.page
+ </Link>
+ </li>
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/project/branches",
+ "query": Object {
+ "id": "foo",
+ },
+ }
+ }
+ >
+ project_branch_pull_request.page
+ </Link>
+ </li>
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/project/baseline",
+ "query": Object {
+ "id": "foo",
+ },
+ }
+ }
+ >
+ project_baseline.page
+ </Link>
+ </li>
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/project/webhooks",
+ "query": Object {
+ "id": "foo",
+ },
+ }
+ }
+ >
+ webhooks.page
+ </Link>
+ </li>
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/project/deletion",
+ "query": Object {
+ "id": "foo",
+ },
+ }
+ }
+ >
+ deletion.page
+ </Link>
+ </li>
+ </ul>
+ }
+ tagName="li"
+ >
+ <Component />
+ </Dropdown>
</NavBarTabs>
`;
</NavBarTabs>
`;
+exports[`should work for pull requests 1`] = `
+<NavBarTabs>
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/dashboard",
+ "query": Object {
+ "id": "foo",
+ "pullRequest": "1001",
+ },
+ }
+ }
+ >
+ overview.page
+ </Link>
+ </li>
+ <li>
+ <Link
+ activeClassName="active"
+ className=""
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/project/issues",
+ "query": Object {
+ "id": "foo",
+ "pullRequest": "1001",
+ "resolved": "false",
+ },
+ }
+ }
+ >
+ issues.page
+ </Link>
+ </li>
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/component_measures",
+ "query": Object {
+ "id": "foo",
+ "pullRequest": "1001",
+ },
+ }
+ }
+ >
+ layout.measures
+ </Link>
+ </li>
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/code",
+ "query": Object {
+ "id": "foo",
+ "pullRequest": "1001",
+ },
+ }
+ }
+ >
+ code.page
+ </Link>
+ </li>
+</NavBarTabs>
+`;
+
+exports[`should work for pull requests 2`] = `
+<NavBarTabs>
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/dashboard",
+ "query": Object {
+ "id": "foo",
+ "pullRequest": "1001",
+ },
+ }
+ }
+ >
+ overview.page
+ </Link>
+ </li>
+ <li>
+ <Link
+ activeClassName="active"
+ className=""
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/project/issues",
+ "query": Object {
+ "id": "foo",
+ "pullRequest": "1001",
+ "resolved": "false",
+ },
+ }
+ }
+ >
+ issues.page
+ </Link>
+ </li>
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/component_measures",
+ "query": Object {
+ "id": "foo",
+ "pullRequest": "1001",
+ },
+ }
+ }
+ >
+ layout.measures
+ </Link>
+ </li>
+ <li>
+ <Link
+ activeClassName="active"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to={
+ Object {
+ "pathname": "/code",
+ "query": Object {
+ "id": "foo",
+ "pullRequest": "1001",
+ },
+ }
+ }
+ >
+ code.page
+ </Link>
+ </li>
+</NavBarTabs>
+`;
+
exports[`should work with extensions 1`] = `
<Dropdown
data-test="extensions"