提交 571bd1da 编写于 作者: R Ramya Achutha Rao

Show experimental prompt only once

上级 8ed94d91
......@@ -64,9 +64,7 @@ export class ExperimentalPrompts extends Disposable implements IWorkbenchContrib
logTelemetry(command.text);
if (command.externalLink) {
window.open(command.externalLink);
return;
}
if (command.curatedExtensionsKey && Array.isArray(command.curatedExtensionsList)) {
} else if (command.curatedExtensionsKey && Array.isArray(command.curatedExtensionsList)) {
this.viewletService.openViewlet('workbench.view.extensions', true)
.then(viewlet => viewlet as IExtensionsViewlet)
.then(viewlet => {
......@@ -74,7 +72,6 @@ export class ExperimentalPrompts extends Disposable implements IWorkbenchContrib
viewlet.search('curated:' + command.curatedExtensionsKey);
}
});
return;
}
this.experimentService.markAsCompleted(experiment.id);
......@@ -83,7 +80,10 @@ export class ExperimentalPrompts extends Disposable implements IWorkbenchContrib
};
});
this.notificationService.prompt(Severity.Info, actionProperties.promptText, choices, logTelemetry);
this.notificationService.prompt(Severity.Info, actionProperties.promptText, choices, () => {
logTelemetry();
this.experimentService.markAsCompleted(experiment.id);
});
}
dispose() {
......
......@@ -42,7 +42,7 @@ suite('Experimental Prompts', () => {
commands: [
{
text: 'Yes',
dontShowAgain: true
externalLink: 'https://code.visualstudio.com'
},
{
text: 'No'
......@@ -88,7 +88,7 @@ suite('Experimental Prompts', () => {
});
test('Show experimental prompt if experiment should be run. Choosing an option should mark experiment as complete', () => {
test('Show experimental prompt if experiment should be run. Choosing option with link should mark experiment as complete', () => {
storageData = {
enabled: true,
......@@ -111,4 +111,52 @@ suite('Experimental Prompts', () => {
});
});
test('Show experimental prompt if experiment should be run. Choosing negative option should mark experiment as complete', () => {
storageData = {
enabled: true,
state: ExperimentState.Run
};
instantiationService.stub(INotificationService, {
prompt: (a: Severity, b: string, c: IPromptChoice[], d) => {
assert.equal(b, promptText);
assert.equal(c.length, 2);
c[1].run();
}
});
experimentalPrompt = instantiationService.createInstance(ExperimentalPrompts);
onExperimentEnabledEvent.fire(experiment);
return TPromise.as(null).then(result => {
assert.equal(storageData['state'], ExperimentState.Complete);
});
});
test('Show experimental prompt if experiment should be run. Cancelling should mark experiment as complete', () => {
storageData = {
enabled: true,
state: ExperimentState.Run
};
instantiationService.stub(INotificationService, {
prompt: (a: Severity, b: string, c: IPromptChoice[], d) => {
assert.equal(b, promptText);
assert.equal(c.length, 2);
d();
}
});
experimentalPrompt = instantiationService.createInstance(ExperimentalPrompts);
onExperimentEnabledEvent.fire(experiment);
return TPromise.as(null).then(result => {
assert.equal(storageData['state'], ExperimentState.Complete);
});
});
});
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册