diff options
Diffstat (limited to 'polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html')
-rw-r--r-- | polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html index ab3302be6b..9668a54d48 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html @@ -1,5 +1,6 @@ <!DOCTYPE html> <!-- +@license Copyright (C) 2016 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,6 +35,7 @@ limitations under the License. <mock-diff-response></mock-diff-response> <gr-diff></gr-diff> <gr-diff-cursor></gr-diff-cursor> + <gr-rest-api-interface></gr-rest-api-interface> </template> </test-fixture> @@ -47,27 +49,18 @@ limitations under the License. setup(done => { sandbox = sinon.sandbox.create(); - stub('gr-rest-api-interface', { - getLoggedIn() { return Promise.resolve(false); }, - }); - const fixtureElems = fixture('basic'); mockDiffResponse = fixtureElems[0]; diffElement = fixtureElems[1]; cursorElement = fixtureElems[2]; + const restAPI = fixtureElems[3]; // Register the diff with the cursor. cursorElement.push('diffs', diffElement); + diffElement.loggedIn = false; + diffElement.patchRange = {basePatchNum: 1, patchNum: 2}; diffElement.comments = {left: [], right: []}; - diffElement.$.restAPI.getDiffPreferences().then(prefs => { - diffElement.prefs = prefs; - }); - - sandbox.stub(diffElement, '_getDiff', () => { - return Promise.resolve(mockDiffResponse.diffResponse); - }); - const setupDone = () => { cursorElement._updateStops(); cursorElement.moveToFirstChunk(); @@ -76,7 +69,10 @@ limitations under the License. }; diffElement.addEventListener('render', setupDone); - diffElement.reload(); + restAPI.getDiffPreferences().then(prefs => { + diffElement.prefs = prefs; + diffElement.diff = mockDiffResponse.diffResponse; + }); }); teardown(() => sandbox.restore()); @@ -218,7 +214,7 @@ limitations under the License. done(); } diffElement.addEventListener('render', renderHandler); - diffElement.reload(); + diffElement._diffChanged(mockDiffResponse.diffResponse); }); test('initialLineNumber enabled', done => { @@ -238,7 +234,7 @@ limitations under the License. cursorElement.initialLineNumber = 10; cursorElement.side = 'right'; - diffElement.reload(); + diffElement._diffChanged(mockDiffResponse.diffResponse); }); test('getAddress', () => { |