Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
#839 - TypeScript definition files are not included in package build (#…
Browse files Browse the repository at this point in the history
…853)

* Include TypeScript library .d.ts files

* Add test case to verify typescript completion

* Bring in autocompletion test
  • Loading branch information
bryphe committed Nov 2, 2017
1 parent d45f1f5 commit 9d9838f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
"!lib_test",
"!test"
],
"extraResources": [{
"from": "node_modules/typescript/lib",
"to": "app/node_modules/typescript/lib"
}],
"mac": {
"artifactName": "${productName}-${version}-osx.${ext}",
"category": "public.app-category.developer-tools",
Expand Down
1 change: 1 addition & 0 deletions test/CiTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Oni } from "./common"
const LongTimeout = 5000

const CiTests = [
"AutoCompletionTest",
"BasicEditingTest",
"QuickOpenTest",
]
Expand Down
38 changes: 38 additions & 0 deletions test/ci/AutoCompletionTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Test scripts for QuickOpen
*/

import * as assert from "assert"
import * as os from "os"
import * as path from "path"

const getCompletionElement = () => {

const elements = document.body.getElementsByClassName("autocompletion")

if (!elements || !elements.length) {
return null
} else {
return elements[0]
}
}

export const test = async (oni: any) => {
const dir = os.tmpdir()
const testFileName = `testFile-${new Date().getTime()}.ts`
const tempFilePath = path.join(dir, testFileName)
oni.automation.sendKeys(":e " + tempFilePath)
oni.automation.sendKeys("<cr>")
await oni.automation.sleep(500)
oni.automation.sendKeys("i")
oni.automation.sendKeys("window.a")

// Wait for completion popup to show
await oni.automation.waitFor(() => getCompletionElement() !== null)

// Check for 'alert' as an available completion
const completionElement = getCompletionElement()
const textContent = completionElement.textContent

assert.ok(textContent.indexOf("alert") >= 0, "Verify 'alert' was presented as a completion")
}

0 comments on commit 9d9838f

Please sign in to comment.