我有一个用打字稿写的组件。我正在使用角度1.5。如何在测试用例中实例化此组件,以便可以测试组件内部的功能?
SFTPFileExplorerComponent.ts
export function SFTPFileExplorerComponent($rootScope) {
let vm = this;
vm.$onInit = () => {
vm.currentDirectory = '';
vm.files = {};
vm.loading = false;
}
vm.setGridData = (connectionId: Number, currentDirectory: String, files: Object) => {
vm.currentDirectory = currentDirectory;
vm.files = files;
vm.connectionId = connectionId;
vm.filesLoaded = true;
}
vm.clearGridData = () => {
vm.currentDirectory = '';
vm.files = [];`enter code here`
vm.connectionId = undefined;
}
}