Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hotfix/close modal goes to activity (#699)
* fix a bug where closing the Run Details modal would navigate back to /activity instead of the previous route in many cases (from Dashboard, from Branches tab) * publish beta core-js; update deps * tick core-js version after publishing 0.0.44; update deps
- Loading branch information
1 parent
bd7928e
commit 39e09e5
Showing
10 changed files
with
95 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
blueocean-core-js/test/js/services/LocationService-spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { assert } from 'chai'; | ||
|
||
import LocationService from '../../../src/js/services/LocationService'; | ||
|
||
/** | ||
* Utility for creating location object passed to history.listen | ||
* @param {string} action | ||
* @param {string} pathname | ||
* @returns {Object} | ||
*/ | ||
function createLocation(pathname, action = 'PUSH') { | ||
return { | ||
action, | ||
pathname, | ||
search: '', | ||
hash: '', | ||
state: null, | ||
key: 'mdrv0s', | ||
basename: '/jenkins/blue', | ||
query: {}, | ||
$searchBase: { | ||
search: '', | ||
searchBase: '', | ||
}, | ||
}; | ||
} | ||
|
||
describe('LocationService', () => { | ||
let locationService; | ||
|
||
beforeEach(() => { | ||
locationService = new LocationService(); | ||
}); | ||
|
||
it('sets current after a route added', () => { | ||
const loc = '/pipelines'; | ||
locationService.setCurrent( | ||
createLocation(loc) | ||
); | ||
|
||
assert.isNotOk(locationService.previous); | ||
assert.equal(locationService.current, loc); | ||
}); | ||
|
||
it('sets previous after two routes added', () => { | ||
const loc = '/pipelines'; | ||
locationService.setCurrent( | ||
createLocation(loc) | ||
); | ||
|
||
const loc2 = '/organizations/jenkins/pipelines'; | ||
locationService.setCurrent( | ||
createLocation(loc2) | ||
); | ||
|
||
assert.equal(locationService.previous, loc); | ||
assert.equal(locationService.current, loc2); | ||
}); | ||
|
||
it('handles the REPLACE scenario', () => { | ||
const loc = '/pipelines'; | ||
locationService.setCurrent( | ||
createLocation(loc) | ||
); | ||
|
||
const loc2 = '/organizations/jankins/pipeline-1/activity'; | ||
locationService.setCurrent( | ||
createLocation(loc2) | ||
); | ||
|
||
const loc3 = '/organizations/jenkins/pipelines'; | ||
locationService.setCurrent( | ||
createLocation(loc3, 'REPLACE') | ||
); | ||
|
||
assert.equal(locationService.previous, loc); | ||
assert.equal(locationService.current, loc3); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters