Skip to content

Commit

Permalink
More grunt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oxixes committed Mar 14, 2024
1 parent 3e98a7a commit 1e48897
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
84 changes: 84 additions & 0 deletions src/js_tests/styledelements/CodeAreaInputInterfaceSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Copyright (c) 2024 Future Internet Consulting and Development Solutions S.L.
*
* This file is part of Wirecloud Platform.
*
* Wirecloud Platform 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.
*
* Wirecloud 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 Wirecloud Platform. If not, see
* <http://www.gnu.org/licenses/>.
*
*/

/* globals StyledElements */

(function (se) {

"use strict";

describe("CodeInputInterface", () => {

let dom = null;

beforeEach(function () {
dom = document.createElement('div');
document.body.appendChild(dom);
});

afterEach(function () {
if (dom != null) {
dom.remove();
dom = null;
}
});

describe("new CodeInputInterface(fieldId, description)", () => {

it("is a class constructor", () => {
expect(() => {
se.CodeInputInterface("pass", {}); // eslint-disable-line new-cap
}).toThrowError(TypeError);
});

it("requires fieldId and description parameters", () => {
expect(() => {
new se.CodeInputInterface();
}).toThrowError(TypeError);
});

it("should work by providing the minimum details", () => {
const field = new se.CodeInputInterface("code", {});
expect(field.id).toBe("code");
expect(field).toEqual(jasmine.any(se.InputInterface));
});

});

describe("CodeInputInterface.parse(value)", () => {

it("should return the value as is", () => {
expect(se.CodeInputInterface.parse("value")).toBe("value");
});

});

describe("CodeInputInterface.stringify(value)", () => {

it("should return the value as is", () => {
expect(se.CodeInputInterface.stringify("value")).toBe("value");
});

});

});

})(StyledElements);
6 changes: 6 additions & 0 deletions src/js_tests/styledelements/CodeAreaSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@

describe("new CodeArea([options])", () => {

afterEach(() => {
if (window.monaco != null) {
delete window.monaco;
}
});

it("is a class constructor", () => {
expect(() => {
se.CodeArea(); // eslint-disable-line new-cap
Expand Down

0 comments on commit 1e48897

Please sign in to comment.