fix: following fflorent review

This commit is contained in:
Grégoire Cutzach 2024-09-12 15:36:51 +02:00
parent 06e308e8ed
commit aa9e42bd47
No known key found for this signature in database
GPG Key ID: AA4155BE23C375E6
3 changed files with 6 additions and 12 deletions

View File

@ -149,7 +149,7 @@ export class DocPageModelImpl extends Disposable implements DocPageModel {
public readonly isTemplate = Computed.create(this, this.currentDoc, public readonly isTemplate = Computed.create(this, this.currentDoc,
(use, doc) => doc ? doc.isTemplate : false); (use, doc) => doc ? doc.isTemplate : false);
public readonly type = Computed.create(this, this.currentDoc, public readonly type = Computed.create(this, this.currentDoc,
(use, doc) => doc?.type?? null); (use, doc) => doc?.type ?? null);
public readonly importSources: ImportSource[] = []; public readonly importSources: ImportSource[] = [];

View File

@ -310,9 +310,6 @@ export class DocSettingsPage extends Disposable {
const currentDocType = docPageModel.type.get() as string; const currentDocType = docPageModel.type.get() as string;
let currentDocTypeOption; let currentDocTypeOption;
switch (currentDocType) { switch (currentDocType) {
case "":
currentDocTypeOption = DocTypeOption.Regular;
break;
case "Template": case "Template":
currentDocTypeOption = DocTypeOption.Template; currentDocTypeOption = DocTypeOption.Template;
break; break;
@ -335,11 +332,8 @@ export class DocSettingsPage extends Disposable {
} else { } else {
docType = "Tutorial"; docType = "Tutorial";
} }
persistType(docType, docId) await persistType(docType, docId);
.then(()=>window.location.reload()) window.location.reload();
.catch(err=>console.log(err));
ctl.close();
}; };
const documentTypeOptions = () => [ const documentTypeOptions = () => [
@ -415,7 +409,7 @@ function persistType(type: string|null, docId: string|undefined){
headers: {"Content-Type": "application/json"}, headers: {"Content-Type": "application/json"},
credentials: 'include', credentials: 'include',
body:JSON.stringify({type}) body:JSON.stringify({type})
}).catch((err)=>{ console.log(err); }); });
} }
function getApiConsoleLink(docPageModel: DocPageModel) { function getApiConsoleLink(docPageModel: DocPageModel) {

View File

@ -1,4 +1,5 @@
import { UserAPI } from "app/common/UserAPI"; import { UserAPI } from "app/common/UserAPI";
//import { assert, By, driver, until } from "mocha-webdriver";
import { assert, driver } from "mocha-webdriver"; import { assert, driver } from "mocha-webdriver";
import * as gu from "test/nbrowser/gristUtils"; import * as gu from "test/nbrowser/gristUtils";
import { setupTestSuite } from "test/nbrowser/testUtils"; import { setupTestSuite } from "test/nbrowser/testUtils";
@ -57,8 +58,7 @@ describe("Document Type Conversion", function () {
// Confirm the choice // Confirm the choice
await modalConfirm.click(); await modalConfirm.click();
// await for the page reload await driver.sleep(3000);
await driver.sleep(1000);
// check that the displayedLabel is now equal to convert destination // check that the displayedLabel is now equal to convert destination
assert.equal(await displayedLabel.element().getText(), to); assert.equal(await displayedLabel.element().getText(), to);