fix selenium tests and cleanup

This commit is contained in:
Oleg Zharkov
2021-10-12 17:08:37 +02:00
parent 852b328c2d
commit 41b49dda3b
2 changed files with 3 additions and 12 deletions
@@ -5,10 +5,8 @@ import { shallowMount, createLocalVue } from "@vue/test-utils";
import flushPromises from "flush-promises";
import { BButton } from "bootstrap-vue";
import MockAdapter from "axios-mock-adapter";
import Vue from "vue";
import axios from "axios";
import BootstrapVue from "bootstrap-vue";
import SelectionDialogMixin from "components/SelectionDialog/SelectionDialogMixin";
import {
rootId,
@@ -117,7 +115,7 @@ describe("FilesDialog, file mode", () => {
// assert that OK button is active
expect(wrapper.vm.hasValue).toBe(true);
// unselect each file
// unselect each file
applyForEachFile((file) => utils.clickOn(file));
// assert that OK button is disabled
@@ -219,11 +217,9 @@ describe("FilesDialog, directory mode", () => {
});
it("should select folders", async () => {
// console.log(wrapper.html());
const btn = wrapper.find("#ok-btn");
expect(btn.attributes().disabled).toBe("disabled");
// const okBtn = buttons.find((btn) => btn.getAttribute("id") === "ok-btn");
await utils.open_root_folder(false);
const folder = utils.getRenderedDirectory(directoryId);
await utils.getTable().$emit("open", folder);
@@ -35,7 +35,7 @@
class="float-right ml-1 file-dialog-modal-ok"
variant="primary"
id="ok-btn"
@click="fileMode ? finalize : selectLeaf(currentDirectory)"
@click="fileMode ? finalize() : selectLeaf(currentDirectory)"
:disabled="(fileMode && !hasValue) || isBusy || (!fileMode && urlTracker.atRoot())"
>
{{ fileMode ? "Ok" : "Select this folder" }}
@@ -227,12 +227,7 @@ export default {
},
/** Called when selection is complete, values are formatted and parsed to external callback **/
finalize: function () {
let results;
if (this.fileMode) {
results = this.model.finalize();
} else {
results = this.currentDirectory.url;
}
const results = this.model.finalize();
this.modalShow = false;
this.callback(results);
},