diff --git a/templates/auth/css/main.scss b/templates/auth/css/main.scss index 97ffbd0f..7c12b669 100644 --- a/templates/auth/css/main.scss +++ b/templates/auth/css/main.scss @@ -41,11 +41,10 @@ body { } .auth__logo { - width: 190px; + width: 160px; display: block; - margin: auto; + margin: 20px auto; position: relative; - transform: translate(0%, -40.9%); } .auth__secondary-action__banner { diff --git a/templates/panel/sitekey/add/css/main.scss b/templates/panel/sitekey/add/css/main.scss index 7c660869..02098f70 100644 --- a/templates/panel/sitekey/add/css/main.scss +++ b/templates/panel/sitekey/add/css/main.scss @@ -62,6 +62,7 @@ width: $form-content-width; box-sizing: border-box; display: flex; + border: none; } .sitekey__level-title { diff --git a/templates/panel/sitekey/add/existing-level.html b/templates/panel/sitekey/add/existing-level.html index 0bd96ea5..62f0e5f3 100644 --- a/templates/panel/sitekey/add/existing-level.html +++ b/templates/panel/sitekey/add/existing-level.html @@ -7,7 +7,7 @@ @@ -17,7 +17,7 @@ Difficulty diff --git a/templates/panel/sitekey/add/ts/addLevelButton.test.ts b/templates/panel/sitekey/add/ts/addLevelButton.test.ts new file mode 100644 index 00000000..1a108a2b --- /dev/null +++ b/templates/panel/sitekey/add/ts/addLevelButton.test.ts @@ -0,0 +1,191 @@ +/* + * Copyright (C) 2021 Aravinth Manivannan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import getNumLevels from './levels/getNumLevels'; +import {getAddForm, addLevel} from './setupTests'; + +document.body.innerHTML = getAddForm(); + +it('addLevelButton works', () => { + expect(getNumLevels()).toBe(1); + // add a level + addLevel(2, 4); + expect(getNumLevels()).toBe(2); + + // try to add duplicate level + addLevel(2, 4); + expect(getNumLevels()).toBe(2); + + // try to add negative parameters + addLevel(-4, -9); + expect(getNumLevels()).toBe(2); + + // add second level + addLevel(4, 9); + expect(getNumLevels()).toBe(3); + + let a = document.body.innerHTML; + + expect(trim(a)).toBe(trim(finalHtml())); +}); + +const trim = (s: string) => s.replace(/\s/g, ''); + +const finalHtml = () => { + return ` +
+

+ Add Sitekey +

+ + + + +
+ + Level 1 + + + + + +
+
+ + Level 2 + + + + + +
+
+ + Level 3 + + + + + +
+ + +
+ `; +}; diff --git a/templates/panel/sitekey/add/ts/addLevelButton.ts b/templates/panel/sitekey/add/ts/addLevelButton.ts index 958f9578..9b7eeafd 100644 --- a/templates/panel/sitekey/add/ts/addLevelButton.ts +++ b/templates/panel/sitekey/add/ts/addLevelButton.ts @@ -16,7 +16,6 @@ */ import validateLevel from './levels/validateLevel'; import getNumLevels from './levels/getNumLevels'; -import {LEVELS} from './levels/'; import * as UpdateLevel from './levels/updateLevel'; import { getRemoveButtonHTML, @@ -82,7 +81,7 @@ const getHtml = (level: number) => { @@ -92,7 +91,7 @@ const getHtml = (level: number) => { Difficulty { let numLevels = 0; diff --git a/templates/panel/sitekey/add/ts/setupTests.ts b/templates/panel/sitekey/add/ts/setupTests.ts index cda0b547..53f69db9 100644 --- a/templates/panel/sitekey/add/ts/setupTests.ts +++ b/templates/panel/sitekey/add/ts/setupTests.ts @@ -132,7 +132,7 @@ export const getAddForm = () => ` @@ -142,7 +142,7 @@ export const getAddForm = () => ` Difficulty