2015-10-26 23:42:25 +01:00
|
|
|
///<reference path="fourslash.ts" />
|
|
|
|
|
|
|
|
// Assignments to the 'prototype' property of a function create a class
|
|
|
|
|
|
|
|
// @allowNonTsExtensions: true
|
|
|
|
// @Filename: myMod.js
|
|
|
|
//// function myCtor(x) {
|
|
|
|
//// }
|
|
|
|
//// myCtor.prototype.foo = function() { return 32 };
|
|
|
|
//// myCtor.prototype.bar = function() { return '' };
|
2018-10-29 18:03:25 +01:00
|
|
|
////
|
2015-10-26 23:42:25 +01:00
|
|
|
//// var m = new myCtor(10);
|
|
|
|
//// m/*1*/
|
2015-10-30 20:34:56 +01:00
|
|
|
//// var a = m.foo;
|
|
|
|
//// a/*2*/
|
|
|
|
//// var b = a();
|
|
|
|
//// b/*3*/
|
|
|
|
//// var c = m.bar();
|
|
|
|
//// c/*4*/
|
2015-10-26 23:42:25 +01:00
|
|
|
|
2015-10-30 20:34:56 +01:00
|
|
|
|
|
|
|
// Members of the class instance
|
2015-10-26 23:42:25 +01:00
|
|
|
goTo.marker('1');
|
|
|
|
edit.insert('.');
|
2018-10-29 18:03:25 +01:00
|
|
|
verify.completions({ includes: ["foo", "bar"].map(name => ({ name, kind: "method" })) });
|
2015-10-26 23:42:25 +01:00
|
|
|
edit.backspace();
|
|
|
|
|
2015-10-30 20:34:56 +01:00
|
|
|
// Members of a class method (1)
|
2015-10-26 23:42:25 +01:00
|
|
|
goTo.marker('2');
|
|
|
|
edit.insert('.');
|
2018-10-30 19:56:34 +01:00
|
|
|
verify.completions({ includes: { name: "length", kind: "property", kindModifiers: "declare" } });
|
2015-10-30 20:34:56 +01:00
|
|
|
edit.backspace();
|
|
|
|
|
|
|
|
// Members of the invocation of a class method (1)
|
|
|
|
goTo.marker('3');
|
|
|
|
edit.insert('.');
|
2018-10-29 18:03:25 +01:00
|
|
|
verify.completions({ includes: "toFixed", excludes: "substr" });
|
2015-10-26 23:42:25 +01:00
|
|
|
edit.backspace();
|
|
|
|
|
2015-10-30 20:34:56 +01:00
|
|
|
// Members of the invocation of a class method (2)
|
|
|
|
goTo.marker('4');
|
2015-10-26 23:42:25 +01:00
|
|
|
edit.insert('.');
|
2018-10-29 18:03:25 +01:00
|
|
|
verify.completions({ includes: "substr", excludes: "toFixed" });
|