mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00

* Added window js wrapper for napi * Remove position tests. * Update api/napi/src/types/size.rs Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com> * Code review fixes --------- Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
38 lines
No EOL
975 B
TypeScript
38 lines
No EOL
975 B
TypeScript
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
|
|
|
|
import test from 'ava'
|
|
|
|
import { ComponentCompiler, Window } from '../index'
|
|
|
|
test('Window constructor', (t) => {
|
|
t.throws(() => {
|
|
new Window()
|
|
},
|
|
{
|
|
code: "GenericFailure",
|
|
message: "Window can only be created by using a Component."
|
|
}
|
|
);
|
|
})
|
|
|
|
test('Window show / hide', (t) => {
|
|
let compiler = new ComponentCompiler;
|
|
let definition = compiler.buildFromSource(`
|
|
|
|
export component App inherits Window {
|
|
width: 300px;
|
|
height: 300px;
|
|
}`, "");
|
|
t.not(definition, null);
|
|
|
|
let instance = definition!.create();
|
|
t.not(instance, null);
|
|
|
|
let window = instance!.window();
|
|
t.is(window.isVisible, false);
|
|
window.show();
|
|
t.is(window.isVisible, true);
|
|
window.hide();
|
|
t.is(window.isVisible, false);
|
|
}) |