mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 17:23:29 -05:00
Add additional notebook tests for handling relative links. (#17739)
This commit is contained in:
@@ -124,7 +124,7 @@ suite('Link Callout Dialog', function (): void {
|
||||
assert.strictEqual(unquoteText(undefined), undefined);
|
||||
});
|
||||
|
||||
test('Should return file link properly', async function (): Promise<void> {
|
||||
test('Should return absolute file link properly', async function (): Promise<void> {
|
||||
const defaultLabel = 'defaultLabel';
|
||||
const sampleUrl = 'C:/Test/Test.ipynb';
|
||||
let linkCalloutDialog = new LinkCalloutDialog('Title', 'below', defaultDialogProperties, defaultLabel, sampleUrl,
|
||||
@@ -146,6 +146,28 @@ suite('Link Callout Dialog', function (): void {
|
||||
assert.strictEqual(result.insertEscapedMarkdown, `[${defaultLabel}](${sampleUrl})`, 'Markdown not returned correctly');
|
||||
});
|
||||
|
||||
test('Should return relative file link properly', async function (): Promise<void> {
|
||||
const defaultLabel = 'defaultLabel';
|
||||
const sampleUrl = '../../Test.ipynb';
|
||||
let linkCalloutDialog = new LinkCalloutDialog('Title', 'below', defaultDialogProperties, defaultLabel, sampleUrl,
|
||||
undefined, themeService, layoutService, telemetryService, contextKeyService, undefined, undefined, undefined);
|
||||
linkCalloutDialog.render();
|
||||
|
||||
let deferred = new Deferred<ILinkCalloutDialogOptions>();
|
||||
// When I first open the callout dialog
|
||||
linkCalloutDialog.open().then(value => {
|
||||
deferred.resolve(value);
|
||||
});
|
||||
linkCalloutDialog.url = sampleUrl;
|
||||
|
||||
// And insert the dialog
|
||||
linkCalloutDialog.insert();
|
||||
let result = await deferred.promise;
|
||||
assert.strictEqual(result.insertUnescapedLinkLabel, defaultLabel, 'Label not returned correctly');
|
||||
assert.strictEqual(result.insertUnescapedLinkUrl, sampleUrl, 'URL not returned correctly');
|
||||
assert.strictEqual(result.insertEscapedMarkdown, `[${defaultLabel}](${sampleUrl})`, 'Markdown not returned correctly');
|
||||
});
|
||||
|
||||
test('Should handle quoted URLs properly', async function (): Promise<void> {
|
||||
const defaultLabel = 'defaultLabel';
|
||||
const unquotedUrl = 'C:/Test/Test.ipynb';
|
||||
|
||||
Reference in New Issue
Block a user