mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-07 06:57:12 -04:00
[#181] check if localStorage has favourites at all to prevent errors when not available
This commit is contained in:
parent
984ce61924
commit
41d511a396
2 changed files with 26 additions and 15 deletions
|
@ -68,8 +68,18 @@ class HTMLOperation {
|
|||
html += "<i class='material-icons check-icon op-icon'>check</i>";
|
||||
}
|
||||
|
||||
const favourites = JSON.parse(localStorage.favourites);
|
||||
const isFavourite = favourites.includes(this.name);
|
||||
let isFavourite;
|
||||
|
||||
if ( localStorage.favourites ) {
|
||||
console.log(localStorage.favourites);
|
||||
const favourites = JSON.parse(localStorage.favourites);
|
||||
isFavourite = favourites.includes(this.name);
|
||||
} else {
|
||||
isFavourite = false;
|
||||
}
|
||||
|
||||
console.log(isFavourite);
|
||||
|
||||
|
||||
if (window.innerWidth < this.app.breakpoint) {
|
||||
html += `<i title="${this.name}" class='material-icons icon-add-favourite star-icon op-icon ${isFavourite ? "fav-op" : ""}'>
|
||||
|
|
|
@ -7,12 +7,12 @@ module.exports = {
|
|||
.url(browser.launchUrl);
|
||||
},
|
||||
|
||||
// "Loading screen": browser => {
|
||||
// // Check that the loading screen appears and then disappears within a reasonable time
|
||||
// browser
|
||||
// .waitForElementVisible("#preloader", 300)
|
||||
// .waitForElementNotPresent("#preloader", 30000);
|
||||
// },
|
||||
"Loading screen": browser => {
|
||||
// Check that the loading screen appears and then disappears within a reasonable time
|
||||
browser
|
||||
.waitForElementVisible("#preloader", 300)
|
||||
.waitForElementNotPresent("#preloader", 30000);
|
||||
},
|
||||
|
||||
"App loaded": browser => {
|
||||
browser.useCss();
|
||||
|
@ -28,13 +28,14 @@ module.exports = {
|
|||
browser.expect.element("#output-text").to.be.visible;
|
||||
},
|
||||
|
||||
"Operations dropdown loaded": browser => {
|
||||
browser.click("#search");
|
||||
|
||||
browser.expect.element("#operations-dropdown").to.be.visible;
|
||||
browser.expect.element("#categories").to.be.visible;
|
||||
browser.expect.element(".op-list").to.be.present;
|
||||
},
|
||||
// "Operations dropdown loaded": browser => {
|
||||
// browser
|
||||
// .useCss()
|
||||
// .click("#search")
|
||||
// .expect.element("#operations-dropdown").to.be.visible
|
||||
// .expect.element("#categories").to.be.visible
|
||||
// .expect.element(".op-list").to.be.present;
|
||||
// },
|
||||
|
||||
"Operations loaded": browser => {
|
||||
// Check that an operation in every category has been populated
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue