mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)
* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 * Bump distro * Upgrade GCC to 4.9 due to yarn install errors * Update build image * Fix bootstrap base url * Bump distro * Fix build errors * Update source map file * Disable checkbox for blocking migration issues (#15131) * disable checkbox for blocking issues * wip * disable checkbox fixes * fix strings * Remove duplicate tsec command * Default to off for tab color if settings not present * re-skip failing tests * Fix mocha error * Bump sqlite version & fix notebooks search view * Turn off esbuild warnings * Update esbuild log level * Fix overflowactionbar tests * Fix ts-ignore in dropdown tests * cleanup/fixes * Fix hygiene * Bundle in entire zone.js module * Remove extra constructor param * bump distro for web compile break * bump distro for web compile break v2 * Undo log level change * New distro * Fix integration test scripts * remove the "no yarn.lock changes" workflow * fix scripts v2 * Update unit test scripts * Ensure ads-kerberos2 updates in .vscodeignore * Try fix unit tests * Upload crash reports * remove nogpu * always upload crashes * Use bash script * Consolidate data/ext dir names * Create in tmp directory Co-authored-by: chlafreniere <hichise@gmail.com> Co-authored-by: Christopher Suh <chsuh@microsoft.com> Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -18,6 +18,10 @@ export interface IResourceUndoRedoElement {
|
||||
readonly type: UndoRedoElementType.Resource;
|
||||
readonly resource: URI;
|
||||
readonly label: string;
|
||||
/**
|
||||
* Show a message to the user confirming when trying to undo this element
|
||||
*/
|
||||
readonly confirmBeforeUndo?: boolean;
|
||||
undo(): Promise<void> | void;
|
||||
redo(): Promise<void> | void;
|
||||
}
|
||||
@@ -26,6 +30,10 @@ export interface IWorkspaceUndoRedoElement {
|
||||
readonly type: UndoRedoElementType.Workspace;
|
||||
readonly resources: readonly URI[];
|
||||
readonly label: string;
|
||||
/**
|
||||
* Show a message to the user confirming when trying to undo this element
|
||||
*/
|
||||
readonly confirmBeforeUndo?: boolean;
|
||||
undo(): Promise<void> | void;
|
||||
redo(): Promise<void> | void;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ class ResourceStackElement {
|
||||
public readonly type = UndoRedoElementType.Resource;
|
||||
public readonly actual: IUndoRedoElement;
|
||||
public readonly label: string;
|
||||
public readonly confirmBeforeUndo: boolean;
|
||||
|
||||
public readonly resourceLabel: string;
|
||||
public readonly strResource: string;
|
||||
@@ -41,6 +42,7 @@ class ResourceStackElement {
|
||||
constructor(actual: IUndoRedoElement, resourceLabel: string, strResource: string, groupId: number, groupOrder: number, sourceId: number, sourceOrder: number) {
|
||||
this.actual = actual;
|
||||
this.label = actual.label;
|
||||
this.confirmBeforeUndo = actual.confirmBeforeUndo || false;
|
||||
this.resourceLabel = resourceLabel;
|
||||
this.strResource = strResource;
|
||||
this.resourceLabels = [this.resourceLabel];
|
||||
@@ -129,6 +131,7 @@ class WorkspaceStackElement {
|
||||
public readonly type = UndoRedoElementType.Workspace;
|
||||
public readonly actual: IWorkspaceUndoRedoElement;
|
||||
public readonly label: string;
|
||||
public readonly confirmBeforeUndo: boolean;
|
||||
|
||||
public readonly resourceLabels: string[];
|
||||
public readonly strResources: string[];
|
||||
@@ -142,6 +145,7 @@ class WorkspaceStackElement {
|
||||
constructor(actual: IWorkspaceUndoRedoElement, resourceLabels: string[], strResources: string[], groupId: number, groupOrder: number, sourceId: number, sourceOrder: number) {
|
||||
this.actual = actual;
|
||||
this.label = actual.label;
|
||||
this.confirmBeforeUndo = actual.confirmBeforeUndo || false;
|
||||
this.resourceLabels = resourceLabels;
|
||||
this.strResources = strResources;
|
||||
this.groupId = groupId;
|
||||
@@ -811,7 +815,7 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
if (element.canSplit()) {
|
||||
this._splitPastWorkspaceElement(element, ignoreResources);
|
||||
this._notificationService.info(message);
|
||||
return new WorkspaceVerificationError(this.undo(strResource));
|
||||
return new WorkspaceVerificationError(this._undo(strResource, 0, true));
|
||||
} else {
|
||||
// Cannot safely split this workspace element => flush all undo/redo stacks
|
||||
for (const strResource of element.strResources) {
|
||||
@@ -899,13 +903,13 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
return null;
|
||||
}
|
||||
|
||||
private _workspaceUndo(strResource: string, element: WorkspaceStackElement): Promise<void> | void {
|
||||
private _workspaceUndo(strResource: string, element: WorkspaceStackElement, undoConfirmed: boolean): Promise<void> | void {
|
||||
const affectedEditStacks = this._getAffectedEditStacks(element);
|
||||
const verificationError = this._checkWorkspaceUndo(strResource, element, affectedEditStacks, /*invalidated resources will be checked after the prepare call*/false);
|
||||
if (verificationError) {
|
||||
return verificationError.returnValue;
|
||||
}
|
||||
return this._confirmAndExecuteWorkspaceUndo(strResource, element, affectedEditStacks);
|
||||
return this._confirmAndExecuteWorkspaceUndo(strResource, element, affectedEditStacks, undoConfirmed);
|
||||
}
|
||||
|
||||
private _isPartOfUndoGroup(element: WorkspaceStackElement): boolean {
|
||||
@@ -933,7 +937,7 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
return false;
|
||||
}
|
||||
|
||||
private async _confirmAndExecuteWorkspaceUndo(strResource: string, element: WorkspaceStackElement, editStackSnapshot: EditStackSnapshot): Promise<void> {
|
||||
private async _confirmAndExecuteWorkspaceUndo(strResource: string, element: WorkspaceStackElement, editStackSnapshot: EditStackSnapshot, undoConfirmed: boolean): Promise<void> {
|
||||
|
||||
if (element.canSplit() && !this._isPartOfUndoGroup(element)) {
|
||||
// this element can be split
|
||||
@@ -959,7 +963,7 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
if (result.choice === 1) {
|
||||
// choice: undo this file
|
||||
this._splitPastWorkspaceElement(element, null);
|
||||
return this.undo(strResource);
|
||||
return this._undo(strResource, 0, true);
|
||||
}
|
||||
|
||||
// choice: undo in all files
|
||||
@@ -969,6 +973,8 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
if (verificationError1) {
|
||||
return verificationError1.returnValue;
|
||||
}
|
||||
|
||||
undoConfirmed = true;
|
||||
}
|
||||
|
||||
// prepare
|
||||
@@ -989,10 +995,10 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
for (const editStack of editStackSnapshot.editStacks) {
|
||||
editStack.moveBackward(element);
|
||||
}
|
||||
return this._safeInvokeWithLocks(element, () => element.actual.undo(), editStackSnapshot, cleanup, () => this._continueUndoInGroup(element.groupId));
|
||||
return this._safeInvokeWithLocks(element, () => element.actual.undo(), editStackSnapshot, cleanup, () => this._continueUndoInGroup(element.groupId, undoConfirmed));
|
||||
}
|
||||
|
||||
private _resourceUndo(editStack: ResourceEditStack, element: ResourceStackElement): Promise<void> | void {
|
||||
private _resourceUndo(editStack: ResourceEditStack, element: ResourceStackElement, undoConfirmed: boolean): Promise<void> | void {
|
||||
if (!element.isValid) {
|
||||
// invalid element => immediately flush edit stack!
|
||||
editStack.flushAllElements();
|
||||
@@ -1008,7 +1014,7 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
}
|
||||
return this._invokeResourcePrepare(element, (cleanup) => {
|
||||
editStack.moveBackward(element);
|
||||
return this._safeInvokeWithLocks(element, () => element.actual.undo(), new EditStackSnapshot([editStack]), cleanup, () => this._continueUndoInGroup(element.groupId));
|
||||
return this._safeInvokeWithLocks(element, () => element.actual.undo(), new EditStackSnapshot([editStack]), cleanup, () => this._continueUndoInGroup(element.groupId, undoConfirmed));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1037,23 +1043,29 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
return [matchedElement, matchedStrResource];
|
||||
}
|
||||
|
||||
private _continueUndoInGroup(groupId: number): Promise<void> | void {
|
||||
private _continueUndoInGroup(groupId: number, undoConfirmed: boolean): Promise<void> | void {
|
||||
if (!groupId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const [, matchedStrResource] = this._findClosestUndoElementInGroup(groupId);
|
||||
if (matchedStrResource) {
|
||||
return this.undo(matchedStrResource);
|
||||
return this._undo(matchedStrResource, 0, undoConfirmed);
|
||||
}
|
||||
}
|
||||
|
||||
public undo(resourceOrSource: URI | UndoRedoSource | string): Promise<void> | void {
|
||||
public undo(resourceOrSource: URI | UndoRedoSource): Promise<void> | void {
|
||||
if (resourceOrSource instanceof UndoRedoSource) {
|
||||
const [, matchedStrResource] = this._findClosestUndoElementWithSource(resourceOrSource.id);
|
||||
return matchedStrResource ? this.undo(matchedStrResource) : undefined;
|
||||
return matchedStrResource ? this._undo(matchedStrResource, resourceOrSource.id, false) : undefined;
|
||||
}
|
||||
const strResource = typeof resourceOrSource === 'string' ? resourceOrSource : this.getUriComparisonKey(resourceOrSource);
|
||||
if (typeof resourceOrSource === 'string') {
|
||||
return this._undo(resourceOrSource, 0, false);
|
||||
}
|
||||
return this._undo(this.getUriComparisonKey(resourceOrSource), 0, false);
|
||||
}
|
||||
|
||||
private _undo(strResource: string, sourceId: number = 0, undoConfirmed: boolean): Promise<void> | void {
|
||||
if (!this._editStacks.has(strResource)) {
|
||||
return;
|
||||
}
|
||||
@@ -1069,15 +1081,21 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
const [matchedElement, matchedStrResource] = this._findClosestUndoElementInGroup(element.groupId);
|
||||
if (element !== matchedElement && matchedStrResource) {
|
||||
// there is an element in the same group that should be undone before this one
|
||||
return this.undo(matchedStrResource);
|
||||
return this._undo(matchedStrResource, sourceId, undoConfirmed);
|
||||
}
|
||||
}
|
||||
|
||||
const shouldPromptForConfirmation = (element.sourceId !== sourceId || element.confirmBeforeUndo);
|
||||
if (shouldPromptForConfirmation && !undoConfirmed) {
|
||||
// Hit a different source or the element asks for prompt before undo, prompt for confirmation
|
||||
return this._confirmAndContinueUndo(strResource, sourceId, element);
|
||||
}
|
||||
|
||||
try {
|
||||
if (element.type === UndoRedoElementType.Workspace) {
|
||||
return this._workspaceUndo(strResource, element);
|
||||
return this._workspaceUndo(strResource, element, undoConfirmed);
|
||||
} else {
|
||||
return this._resourceUndo(editStack, element);
|
||||
return this._resourceUndo(editStack, element, undoConfirmed);
|
||||
}
|
||||
} finally {
|
||||
if (DEBUG) {
|
||||
@@ -1086,6 +1104,28 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
}
|
||||
}
|
||||
|
||||
private async _confirmAndContinueUndo(strResource: string, sourceId: number, element: StackElement): Promise<void> {
|
||||
const result = await this._dialogService.show(
|
||||
Severity.Info,
|
||||
nls.localize('confirmDifferentSource', "Would you like to undo '{0}'?", element.label),
|
||||
[
|
||||
nls.localize('confirmDifferentSource.ok', "Undo"),
|
||||
nls.localize('cancel', "Cancel"),
|
||||
],
|
||||
{
|
||||
cancelId: 1
|
||||
}
|
||||
);
|
||||
|
||||
if (result.choice === 1) {
|
||||
// choice: cancel
|
||||
return;
|
||||
}
|
||||
|
||||
// choice: undo
|
||||
return this._undo(strResource, sourceId, true);
|
||||
}
|
||||
|
||||
private _findClosestRedoElementWithSource(sourceId: number): [StackElement | null, string | null] {
|
||||
if (!sourceId) {
|
||||
return [null, null];
|
||||
@@ -1128,7 +1168,7 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
if (element.canSplit()) {
|
||||
this._splitFutureWorkspaceElement(element, ignoreResources);
|
||||
this._notificationService.info(message);
|
||||
return new WorkspaceVerificationError(this.redo(strResource));
|
||||
return new WorkspaceVerificationError(this._redo(strResource));
|
||||
} else {
|
||||
// Cannot safely split this workspace element => flush all undo/redo stacks
|
||||
for (const strResource of element.strResources) {
|
||||
@@ -1300,16 +1340,22 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
|
||||
const [, matchedStrResource] = this._findClosestRedoElementInGroup(groupId);
|
||||
if (matchedStrResource) {
|
||||
return this.redo(matchedStrResource);
|
||||
return this._redo(matchedStrResource);
|
||||
}
|
||||
}
|
||||
|
||||
public redo(resourceOrSource: URI | UndoRedoSource | string): Promise<void> | void {
|
||||
if (resourceOrSource instanceof UndoRedoSource) {
|
||||
const [, matchedStrResource] = this._findClosestRedoElementWithSource(resourceOrSource.id);
|
||||
return matchedStrResource ? this.redo(matchedStrResource) : undefined;
|
||||
return matchedStrResource ? this._redo(matchedStrResource) : undefined;
|
||||
}
|
||||
const strResource = typeof resourceOrSource === 'string' ? resourceOrSource : this.getUriComparisonKey(resourceOrSource);
|
||||
if (typeof resourceOrSource === 'string') {
|
||||
return this._redo(resourceOrSource);
|
||||
}
|
||||
return this._redo(this.getUriComparisonKey(resourceOrSource));
|
||||
}
|
||||
|
||||
private _redo(strResource: string): Promise<void> | void {
|
||||
if (!this._editStacks.has(strResource)) {
|
||||
return;
|
||||
}
|
||||
@@ -1325,7 +1371,7 @@ export class UndoRedoService implements IUndoRedoService {
|
||||
const [matchedElement, matchedStrResource] = this._findClosestRedoElementInGroup(element.groupId);
|
||||
if (element !== matchedElement && matchedStrResource) {
|
||||
// there is an element in the same group that should be redone before this one
|
||||
return this.redo(matchedStrResource);
|
||||
return this._redo(matchedStrResource);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ suite('UndoRedoService', () => {
|
||||
const resource = URI.file('test.txt');
|
||||
const service = createUndoRedoService();
|
||||
|
||||
assert.equal(service.canUndo(resource), false);
|
||||
assert.equal(service.canRedo(resource), false);
|
||||
assert.equal(service.hasElements(resource), false);
|
||||
assert.strictEqual(service.canUndo(resource), false);
|
||||
assert.strictEqual(service.canRedo(resource), false);
|
||||
assert.strictEqual(service.hasElements(resource), false);
|
||||
assert.ok(service.getLastElement(resource) === null);
|
||||
|
||||
let undoCall1 = 0;
|
||||
@@ -39,27 +39,27 @@ suite('UndoRedoService', () => {
|
||||
};
|
||||
service.pushElement(element1);
|
||||
|
||||
assert.equal(undoCall1, 0);
|
||||
assert.equal(redoCall1, 0);
|
||||
assert.equal(service.canUndo(resource), true);
|
||||
assert.equal(service.canRedo(resource), false);
|
||||
assert.equal(service.hasElements(resource), true);
|
||||
assert.strictEqual(undoCall1, 0);
|
||||
assert.strictEqual(redoCall1, 0);
|
||||
assert.strictEqual(service.canUndo(resource), true);
|
||||
assert.strictEqual(service.canRedo(resource), false);
|
||||
assert.strictEqual(service.hasElements(resource), true);
|
||||
assert.ok(service.getLastElement(resource) === element1);
|
||||
|
||||
service.undo(resource);
|
||||
assert.equal(undoCall1, 1);
|
||||
assert.equal(redoCall1, 0);
|
||||
assert.equal(service.canUndo(resource), false);
|
||||
assert.equal(service.canRedo(resource), true);
|
||||
assert.equal(service.hasElements(resource), true);
|
||||
assert.strictEqual(undoCall1, 1);
|
||||
assert.strictEqual(redoCall1, 0);
|
||||
assert.strictEqual(service.canUndo(resource), false);
|
||||
assert.strictEqual(service.canRedo(resource), true);
|
||||
assert.strictEqual(service.hasElements(resource), true);
|
||||
assert.ok(service.getLastElement(resource) === null);
|
||||
|
||||
service.redo(resource);
|
||||
assert.equal(undoCall1, 1);
|
||||
assert.equal(redoCall1, 1);
|
||||
assert.equal(service.canUndo(resource), true);
|
||||
assert.equal(service.canRedo(resource), false);
|
||||
assert.equal(service.hasElements(resource), true);
|
||||
assert.strictEqual(undoCall1, 1);
|
||||
assert.strictEqual(redoCall1, 1);
|
||||
assert.strictEqual(service.canUndo(resource), true);
|
||||
assert.strictEqual(service.canRedo(resource), false);
|
||||
assert.strictEqual(service.hasElements(resource), true);
|
||||
assert.ok(service.getLastElement(resource) === element1);
|
||||
|
||||
let undoCall2 = 0;
|
||||
@@ -73,24 +73,24 @@ suite('UndoRedoService', () => {
|
||||
};
|
||||
service.pushElement(element2);
|
||||
|
||||
assert.equal(undoCall1, 1);
|
||||
assert.equal(redoCall1, 1);
|
||||
assert.equal(undoCall2, 0);
|
||||
assert.equal(redoCall2, 0);
|
||||
assert.equal(service.canUndo(resource), true);
|
||||
assert.equal(service.canRedo(resource), false);
|
||||
assert.equal(service.hasElements(resource), true);
|
||||
assert.strictEqual(undoCall1, 1);
|
||||
assert.strictEqual(redoCall1, 1);
|
||||
assert.strictEqual(undoCall2, 0);
|
||||
assert.strictEqual(redoCall2, 0);
|
||||
assert.strictEqual(service.canUndo(resource), true);
|
||||
assert.strictEqual(service.canRedo(resource), false);
|
||||
assert.strictEqual(service.hasElements(resource), true);
|
||||
assert.ok(service.getLastElement(resource) === element2);
|
||||
|
||||
service.undo(resource);
|
||||
|
||||
assert.equal(undoCall1, 1);
|
||||
assert.equal(redoCall1, 1);
|
||||
assert.equal(undoCall2, 1);
|
||||
assert.equal(redoCall2, 0);
|
||||
assert.equal(service.canUndo(resource), true);
|
||||
assert.equal(service.canRedo(resource), true);
|
||||
assert.equal(service.hasElements(resource), true);
|
||||
assert.strictEqual(undoCall1, 1);
|
||||
assert.strictEqual(redoCall1, 1);
|
||||
assert.strictEqual(undoCall2, 1);
|
||||
assert.strictEqual(redoCall2, 0);
|
||||
assert.strictEqual(service.canUndo(resource), true);
|
||||
assert.strictEqual(service.canRedo(resource), true);
|
||||
assert.strictEqual(service.hasElements(resource), true);
|
||||
assert.ok(service.getLastElement(resource) === null);
|
||||
|
||||
let undoCall3 = 0;
|
||||
@@ -104,28 +104,28 @@ suite('UndoRedoService', () => {
|
||||
};
|
||||
service.pushElement(element3);
|
||||
|
||||
assert.equal(undoCall1, 1);
|
||||
assert.equal(redoCall1, 1);
|
||||
assert.equal(undoCall2, 1);
|
||||
assert.equal(redoCall2, 0);
|
||||
assert.equal(undoCall3, 0);
|
||||
assert.equal(redoCall3, 0);
|
||||
assert.equal(service.canUndo(resource), true);
|
||||
assert.equal(service.canRedo(resource), false);
|
||||
assert.equal(service.hasElements(resource), true);
|
||||
assert.strictEqual(undoCall1, 1);
|
||||
assert.strictEqual(redoCall1, 1);
|
||||
assert.strictEqual(undoCall2, 1);
|
||||
assert.strictEqual(redoCall2, 0);
|
||||
assert.strictEqual(undoCall3, 0);
|
||||
assert.strictEqual(redoCall3, 0);
|
||||
assert.strictEqual(service.canUndo(resource), true);
|
||||
assert.strictEqual(service.canRedo(resource), false);
|
||||
assert.strictEqual(service.hasElements(resource), true);
|
||||
assert.ok(service.getLastElement(resource) === element3);
|
||||
|
||||
service.undo(resource);
|
||||
|
||||
assert.equal(undoCall1, 1);
|
||||
assert.equal(redoCall1, 1);
|
||||
assert.equal(undoCall2, 1);
|
||||
assert.equal(redoCall2, 0);
|
||||
assert.equal(undoCall3, 1);
|
||||
assert.equal(redoCall3, 0);
|
||||
assert.equal(service.canUndo(resource), true);
|
||||
assert.equal(service.canRedo(resource), true);
|
||||
assert.equal(service.hasElements(resource), true);
|
||||
assert.strictEqual(undoCall1, 1);
|
||||
assert.strictEqual(redoCall1, 1);
|
||||
assert.strictEqual(undoCall2, 1);
|
||||
assert.strictEqual(redoCall2, 0);
|
||||
assert.strictEqual(undoCall3, 1);
|
||||
assert.strictEqual(redoCall3, 0);
|
||||
assert.strictEqual(service.canUndo(resource), true);
|
||||
assert.strictEqual(service.canRedo(resource), true);
|
||||
assert.strictEqual(service.hasElements(resource), true);
|
||||
assert.ok(service.getLastElement(resource) === null);
|
||||
});
|
||||
|
||||
@@ -169,50 +169,50 @@ suite('UndoRedoService', () => {
|
||||
};
|
||||
service.pushElement(element1);
|
||||
|
||||
assert.equal(service.canUndo(resource1), true);
|
||||
assert.equal(service.canRedo(resource1), false);
|
||||
assert.equal(service.hasElements(resource1), true);
|
||||
assert.strictEqual(service.canUndo(resource1), true);
|
||||
assert.strictEqual(service.canRedo(resource1), false);
|
||||
assert.strictEqual(service.hasElements(resource1), true);
|
||||
assert.ok(service.getLastElement(resource1) === element1);
|
||||
assert.equal(service.canUndo(resource2), true);
|
||||
assert.equal(service.canRedo(resource2), false);
|
||||
assert.equal(service.hasElements(resource2), true);
|
||||
assert.strictEqual(service.canUndo(resource2), true);
|
||||
assert.strictEqual(service.canRedo(resource2), false);
|
||||
assert.strictEqual(service.hasElements(resource2), true);
|
||||
assert.ok(service.getLastElement(resource2) === element1);
|
||||
|
||||
await service.undo(resource1);
|
||||
|
||||
assert.equal(undoCall1, 1);
|
||||
assert.equal(redoCall1, 0);
|
||||
assert.equal(service.canUndo(resource1), false);
|
||||
assert.equal(service.canRedo(resource1), true);
|
||||
assert.equal(service.hasElements(resource1), true);
|
||||
assert.strictEqual(undoCall1, 1);
|
||||
assert.strictEqual(redoCall1, 0);
|
||||
assert.strictEqual(service.canUndo(resource1), false);
|
||||
assert.strictEqual(service.canRedo(resource1), true);
|
||||
assert.strictEqual(service.hasElements(resource1), true);
|
||||
assert.ok(service.getLastElement(resource1) === null);
|
||||
assert.equal(service.canUndo(resource2), false);
|
||||
assert.equal(service.canRedo(resource2), true);
|
||||
assert.equal(service.hasElements(resource2), true);
|
||||
assert.strictEqual(service.canUndo(resource2), false);
|
||||
assert.strictEqual(service.canRedo(resource2), true);
|
||||
assert.strictEqual(service.hasElements(resource2), true);
|
||||
assert.ok(service.getLastElement(resource2) === null);
|
||||
|
||||
await service.redo(resource2);
|
||||
assert.equal(undoCall1, 1);
|
||||
assert.equal(redoCall1, 1);
|
||||
assert.equal(undoCall11, 0);
|
||||
assert.equal(redoCall11, 0);
|
||||
assert.equal(undoCall12, 0);
|
||||
assert.equal(redoCall12, 0);
|
||||
assert.equal(service.canUndo(resource1), true);
|
||||
assert.equal(service.canRedo(resource1), false);
|
||||
assert.equal(service.hasElements(resource1), true);
|
||||
assert.strictEqual(undoCall1, 1);
|
||||
assert.strictEqual(redoCall1, 1);
|
||||
assert.strictEqual(undoCall11, 0);
|
||||
assert.strictEqual(redoCall11, 0);
|
||||
assert.strictEqual(undoCall12, 0);
|
||||
assert.strictEqual(redoCall12, 0);
|
||||
assert.strictEqual(service.canUndo(resource1), true);
|
||||
assert.strictEqual(service.canRedo(resource1), false);
|
||||
assert.strictEqual(service.hasElements(resource1), true);
|
||||
assert.ok(service.getLastElement(resource1) === element1);
|
||||
assert.equal(service.canUndo(resource2), true);
|
||||
assert.equal(service.canRedo(resource2), false);
|
||||
assert.equal(service.hasElements(resource2), true);
|
||||
assert.strictEqual(service.canUndo(resource2), true);
|
||||
assert.strictEqual(service.canRedo(resource2), false);
|
||||
assert.strictEqual(service.hasElements(resource2), true);
|
||||
assert.ok(service.getLastElement(resource2) === element1);
|
||||
|
||||
});
|
||||
|
||||
test('UndoRedoGroup.None uses id 0', () => {
|
||||
assert.equal(UndoRedoGroup.None.id, 0);
|
||||
assert.equal(UndoRedoGroup.None.nextOrder(), 0);
|
||||
assert.equal(UndoRedoGroup.None.nextOrder(), 0);
|
||||
assert.strictEqual(UndoRedoGroup.None.id, 0);
|
||||
assert.strictEqual(UndoRedoGroup.None.nextOrder(), 0);
|
||||
assert.strictEqual(UndoRedoGroup.None.nextOrder(), 0);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user