mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-08 07:21:02 -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>";
|
html += "<i class='material-icons check-icon op-icon'>check</i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isFavourite;
|
||||||
|
|
||||||
|
if ( localStorage.favourites ) {
|
||||||
|
console.log(localStorage.favourites);
|
||||||
const favourites = JSON.parse(localStorage.favourites);
|
const favourites = JSON.parse(localStorage.favourites);
|
||||||
const isFavourite = favourites.includes(this.name);
|
isFavourite = favourites.includes(this.name);
|
||||||
|
} else {
|
||||||
|
isFavourite = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(isFavourite);
|
||||||
|
|
||||||
|
|
||||||
if (window.innerWidth < this.app.breakpoint) {
|
if (window.innerWidth < this.app.breakpoint) {
|
||||||
html += `<i title="${this.name}" class='material-icons icon-add-favourite star-icon op-icon ${isFavourite ? "fav-op" : ""}'>
|
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);
|
.url(browser.launchUrl);
|
||||||
},
|
},
|
||||||
|
|
||||||
// "Loading screen": browser => {
|
"Loading screen": browser => {
|
||||||
// // Check that the loading screen appears and then disappears within a reasonable time
|
// Check that the loading screen appears and then disappears within a reasonable time
|
||||||
// browser
|
browser
|
||||||
// .waitForElementVisible("#preloader", 300)
|
.waitForElementVisible("#preloader", 300)
|
||||||
// .waitForElementNotPresent("#preloader", 30000);
|
.waitForElementNotPresent("#preloader", 30000);
|
||||||
// },
|
},
|
||||||
|
|
||||||
"App loaded": browser => {
|
"App loaded": browser => {
|
||||||
browser.useCss();
|
browser.useCss();
|
||||||
|
@ -28,13 +28,14 @@ module.exports = {
|
||||||
browser.expect.element("#output-text").to.be.visible;
|
browser.expect.element("#output-text").to.be.visible;
|
||||||
},
|
},
|
||||||
|
|
||||||
"Operations dropdown loaded": browser => {
|
// "Operations dropdown loaded": browser => {
|
||||||
browser.click("#search");
|
// browser
|
||||||
|
// .useCss()
|
||||||
browser.expect.element("#operations-dropdown").to.be.visible;
|
// .click("#search")
|
||||||
browser.expect.element("#categories").to.be.visible;
|
// .expect.element("#operations-dropdown").to.be.visible
|
||||||
browser.expect.element(".op-list").to.be.present;
|
// .expect.element("#categories").to.be.visible
|
||||||
},
|
// .expect.element(".op-list").to.be.present;
|
||||||
|
// },
|
||||||
|
|
||||||
"Operations loaded": browser => {
|
"Operations loaded": browser => {
|
||||||
// Check that an operation in every category has been populated
|
// Check that an operation in every category has been populated
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue