-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display Cloud banner on self-hosted instances (#564)
* Display banner unless disabled * add tests * Update copy * Make Cloud banner sticky * Update Header top position when Cloud banner is closed * Adjust header height based on visible banners
- Loading branch information
Showing
7 changed files
with
99 additions
and
72 deletions.
There are no files selected for viewing
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,23 @@ | ||
const SELECTOR = '.cloud-banner' | ||
|
||
describe('Cloud Banner', () => { | ||
it('should show cloud banner by default', () => { | ||
cy.visit('/') | ||
cy.get(SELECTOR).should('be.visible') | ||
}) | ||
|
||
it('should hide cloud banner when cloud_banner=false query param is present', () => { | ||
cy.visit('/?cloud_banner=false') | ||
cy.get(SELECTOR).should('not.exist') | ||
}) | ||
|
||
it('should show cloud banner with other query params when cloud_banner is not false', () => { | ||
cy.visit('/?cloud_banner=true&other_param=123') | ||
cy.get(SELECTOR).should('be.visible') | ||
}) | ||
|
||
it('should show cloud banner with invalid cloud_banner values', () => { | ||
cy.visit('/?cloud_banner=invalid') | ||
cy.get(SELECTOR).should('be.visible') | ||
}) | ||
}) |
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
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
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,14 @@ | ||
/** @const {string} Name of the query parameter that controls banner visibility */ | ||
const QUERY_PARAM_NAME = 'cloud_banner' | ||
|
||
/** | ||
* Checks if the cloud banner should be enabled based on URL query parameters | ||
* @returns {boolean} True if banner should be shown, false if explicitly disabled via query param | ||
*/ | ||
const isBannerEnabled = () => { | ||
const urlParams = new URLSearchParams(window.location.search) | ||
const cloudBannerQueryParam = urlParams.get(QUERY_PARAM_NAME) | ||
return cloudBannerQueryParam !== 'false' | ||
} | ||
|
||
export default isBannerEnabled |
This file was deleted.
Oops, something went wrong.