-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
16 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,42 @@ | ||
import * as assert from 'assert'; | ||
import * as vscode from 'vscode'; | ||
import * as path from 'path'; | ||
import { openFileInVscode, workspaceFilePath, catchAsync } from '../helpers'; | ||
import { openFileInVscode, workspaceFilePath } from '../helpers'; | ||
|
||
suite('AngularHtmlDefinitionProvider', () => { | ||
const templateFilePath = workspaceFilePath('foo.component.html'); | ||
|
||
suiteSetup(catchAsync(async (done) => { | ||
suiteSetup(async () => { | ||
await openFileInVscode(templateFilePath); | ||
done(); | ||
})); | ||
}); | ||
|
||
test('should resolve interpolation', catchAsync(async (done) => { | ||
test('should resolve interpolation', async () => { | ||
const result = await vscode.commands.executeCommand<vscode.Location[]>('vscode.executeDefinitionProvider', | ||
vscode.Uri.file(templateFilePath), new vscode.Position(1, 8)); | ||
|
||
assert.notEqual(result[0], undefined, 'file did not resolve'); | ||
assert.equal(result[0].uri.fsPath, workspaceFilePath('foo.component.ts'), 'wrong file resolution'); | ||
assert.equal(result[0].range.start.line, 6, 'wrong line position'); | ||
assert.equal(result[0].range.start.character, 7, 'wrong character position'); | ||
done(); | ||
})); | ||
}); | ||
|
||
test('should resolve one way binded input', catchAsync(async (done) => { | ||
test('should resolve one way binded input', async () => { | ||
const result = await vscode.commands.executeCommand<vscode.Location[]>('vscode.executeDefinitionProvider', | ||
vscode.Uri.file(templateFilePath), new vscode.Position(2, 40)); | ||
|
||
assert.notEqual(result[0], undefined, 'file did not resolve'); | ||
assert.equal(result[0].uri.fsPath, workspaceFilePath('foo.component.ts'), 'wrong file resolution'); | ||
assert.equal(result[0].range.start.line, 7, 'wrong line position'); | ||
assert.equal(result[0].range.start.character, 10, 'wrong character position'); | ||
done(); | ||
})); | ||
}); | ||
|
||
test('should resolve two way binded input', catchAsync(async (done) => { | ||
test('should resolve two way binded input', async () => { | ||
const result = await vscode.commands.executeCommand<vscode.Location[]>('vscode.executeDefinitionProvider', | ||
vscode.Uri.file(templateFilePath), new vscode.Position(2, 62)); | ||
|
||
assert.notEqual(result[0], undefined, 'file did not resolve'); | ||
assert.equal(result[0].uri.fsPath, workspaceFilePath('foo.component.ts'), 'wrong file resolution'); | ||
assert.equal(result[0].range.start.line, 8, 'wrong line position'); | ||
assert.equal(result[0].range.start.character, 7, 'wrong character position'); | ||
done(); | ||
})); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,32 @@ | ||
import * as assert from 'assert'; | ||
import * as vscode from 'vscode'; | ||
import * as path from 'path'; | ||
import { openFileInVscode, workspaceFilePath, catchAsync } from '../helpers'; | ||
import { openFileInVscode, workspaceFilePath } from '../helpers'; | ||
|
||
suite('AngularTsDefinitionProvider', () => { | ||
const componentFilePath = workspaceFilePath('foo.component.ts'); | ||
|
||
suiteSetup(catchAsync(async (done) => { | ||
suiteSetup(async () => { | ||
await openFileInVscode(componentFilePath); | ||
done(); | ||
})); | ||
}); | ||
|
||
test('should go to templateUrl declaration', catchAsync(async (done) => { | ||
test('should go to templateUrl declaration', async () => { | ||
const result = await vscode.commands.executeCommand<vscode.Location[]>('vscode.executeDefinitionProvider', | ||
vscode.Uri.file(componentFilePath), new vscode.Position(2, 22)); | ||
|
||
assert.notEqual(result[0], undefined, 'file did not resolve'); | ||
assert.equal(result[0].uri.fsPath, workspaceFilePath('foo.component.html'), 'wrong file resolution'); | ||
assert.equal(result[0].range.start.line, 0, 'wrong line position'); | ||
assert.equal(result[0].range.start.character, 0, 'wrong character position'); | ||
done(); | ||
})); | ||
}); | ||
|
||
test('should go to styleUrls declaration', catchAsync(async (done) => { | ||
test('should go to styleUrls declaration', async () => { | ||
const result = await vscode.commands.executeCommand<vscode.Location[]>('vscode.executeDefinitionProvider', | ||
vscode.Uri.file(componentFilePath), new vscode.Position(3, 22)); | ||
|
||
assert.notEqual(result[0], undefined, 'file did not resolve'); | ||
assert.equal(result[0].uri.fsPath, workspaceFilePath('foo.component.css'), 'wrong file resolution'); | ||
assert.equal(result[0].range.start.line, 0, 'wrong line position'); | ||
assert.equal(result[0].range.start.character, 0, 'wrong character position'); | ||
done(); | ||
})); | ||
}); | ||
}); |