2021-08-26 20:59:13 +02:00
|
|
|
/**
|
|
|
|
* Test file for Etemplate webComponent Textbox
|
|
|
|
*/
|
2022-02-15 20:48:01 +01:00
|
|
|
import {assert, fixture, html} from '@open-wc/testing';
|
2021-08-26 20:59:13 +02:00
|
|
|
import {Et2Textbox} from "../Et2Textbox";
|
2021-12-10 21:24:06 +01:00
|
|
|
import {inputBasicTests} from "../../Et2InputWidget/test/InputBasicTests";
|
|
|
|
|
|
|
|
// Reference to component under test
|
|
|
|
let element : Et2Textbox;
|
|
|
|
|
|
|
|
async function before()
|
|
|
|
{
|
|
|
|
// Create an element to test with, and wait until it's ready
|
|
|
|
element = await fixture<Et2Textbox>(html`
|
|
|
|
<et2-textbox></et2-textbox>
|
|
|
|
`);
|
|
|
|
return element;
|
|
|
|
}
|
2021-08-26 20:59:13 +02:00
|
|
|
|
|
|
|
describe("Textbox widget", () =>
|
|
|
|
{
|
|
|
|
|
|
|
|
// Setup run before each test
|
2021-12-10 21:24:06 +01:00
|
|
|
beforeEach(before);
|
2021-08-26 20:59:13 +02:00
|
|
|
|
|
|
|
it('is defined', () =>
|
|
|
|
{
|
|
|
|
assert.instanceOf(element, Et2Textbox);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('has a label', () =>
|
|
|
|
{
|
|
|
|
element.set_label("Yay label");
|
|
|
|
assert.isEmpty(element.shadowRoot.querySelectorAll('.et2_label'));
|
|
|
|
})
|
2021-12-10 21:24:06 +01:00
|
|
|
});
|
|
|
|
inputBasicTests(before, "I'm a good test value", "input");
|