|
| 1 | +/// <reference path="./fourslash.ts" /> |
| 2 | + |
| 3 | +// @filename: /package.json |
| 4 | +//// { "dependencies": { "@types/classnames": "*" } } |
| 5 | + |
| 6 | +// @filename: /tsconfig.json |
| 7 | +//// { |
| 8 | +//// "compilerOptions": { |
| 9 | +//// "module": "esnext", |
| 10 | +//// "target": "es2015", |
| 11 | +//// "esModuleInterop": true, |
| 12 | +//// "allowSyntheticDefaultImports": true |
| 13 | +//// } |
| 14 | +//// } |
| 15 | + |
| 16 | +// @filename: /node_modules/@types/classnames/package.json |
| 17 | +//// { "name": "@types/classnames", "types": "index.d.ts" } |
| 18 | + |
| 19 | +// @filename: /node_modules/@types/classnames/index.d.ts |
| 20 | +//// declare const classNames = () => string; |
| 21 | +//// export = classNames; |
| 22 | + |
| 23 | +// @filename: /SomeReactComponent.tsx |
| 24 | +//// import * as React from 'react'; |
| 25 | +//// |
| 26 | +//// const el = <div className={class/*0*/}>foo</div>; |
| 27 | +//// const el = <div className={classNames/*1*/}>foo</div>; |
| 28 | + |
| 29 | +goTo.marker("0"); |
| 30 | + |
| 31 | +verify.completions({ |
| 32 | + includes: [{ |
| 33 | + name: "classNames", |
| 34 | + hasAction: true, |
| 35 | + source: "/node_modules/@types/classnames/index", |
| 36 | + sortText: completion.SortText.AutoImportSuggestions, |
| 37 | + }], |
| 38 | + preferences: { |
| 39 | + includeCompletionsForModuleExports: true, |
| 40 | + } |
| 41 | +}); |
| 42 | + |
| 43 | +goTo.marker("1"); |
| 44 | + |
| 45 | +format.setOption("newLineCharacter", "\n"); |
| 46 | +verify.importFixAtPosition([ |
| 47 | +`import classNames from 'classnames'; |
| 48 | +import * as React from 'react'; |
| 49 | +
|
| 50 | +const el = <div className={class}>foo</div>; |
| 51 | +const el = <div className={classNames}>foo</div>;` |
| 52 | +]); |
0 commit comments