summaryrefslogtreecommitdiff
path: root/spec/javascripts/diffs/components/app_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/diffs/components/app_spec.js')
-rw-r--r--spec/javascripts/diffs/components/app_spec.js37
1 files changed, 5 insertions, 32 deletions
diff --git a/spec/javascripts/diffs/components/app_spec.js b/spec/javascripts/diffs/components/app_spec.js
index 3c9b5ee0176..1e2f7ff4fd8 100644
--- a/spec/javascripts/diffs/components/app_spec.js
+++ b/spec/javascripts/diffs/components/app_spec.js
@@ -3,7 +3,6 @@ import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper
import { TEST_HOST } from 'spec/test_constants';
import App from '~/diffs/components/app.vue';
import createDiffsStore from '../create_diffs_store';
-import getDiffWithCommit from '../mock_data/diff_with_commit';
describe('diffs/components/app', () => {
const oldMrTabs = window.mrTabs;
@@ -14,6 +13,8 @@ describe('diffs/components/app', () => {
beforeEach(() => {
// setup globals (needed for component to mount :/)
window.mrTabs = jasmine.createSpyObj('mrTabs', ['resetViewContainer']);
+ window.mrTabs.expandViewContainer = jasmine.createSpy();
+ window.location.hash = 'ABC_123';
// setup component
const store = createDiffsStore();
@@ -41,40 +42,12 @@ describe('diffs/components/app', () => {
expect(vm.$el).not.toContainElement('.blob-commit-info');
});
- it('shows comments message, with commit', done => {
- vm.$store.state.diffs.commit = getDiffWithCommit().commit;
+ it('sets highlighted row if hash exists in location object', done => {
+ vm.$props.shouldShow = true;
vm.$nextTick()
.then(() => {
- expect(vm.$el).toContainText('Only comments from the following commit are shown below');
- expect(vm.$el).toContainElement('.blob-commit-info');
- })
- .then(done)
- .catch(done.fail);
- });
-
- it('shows comments message, with old mergeRequestDiff', done => {
- vm.$store.state.diffs.mergeRequestDiff = { latest: false };
- vm.$store.state.diffs.targetBranch = 'master';
-
- vm.$nextTick()
- .then(() => {
- expect(vm.$el).toContainText(
- "Not all comments are displayed because you're viewing an old version of the diff.",
- );
- })
- .then(done)
- .catch(done.fail);
- });
-
- it('shows comments message, with startVersion', done => {
- vm.$store.state.diffs.startVersion = 'test';
-
- vm.$nextTick()
- .then(() => {
- expect(vm.$el).toContainText(
- "Not all comments are displayed because you're comparing two versions of the diff.",
- );
+ expect(vm.$store.state.diffs.highlightedRow).toBe('ABC_123');
})
.then(done)
.catch(done.fail);