Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.lang.dart.highlighting;

import com.intellij.codeInsight.daemon.impl.analysis.HtmlUnknownTargetInspection;
import com.intellij.codeInspection.htmlInspections.HtmlUnknownTagInspection;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.psi.PsiFile;
import com.intellij.spellchecker.inspections.SpellCheckingInspection;
import com.intellij.testFramework.ExpectedHighlightingData;
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import com.jetbrains.lang.dart.DartCodeInsightFixtureTestCase;
import com.jetbrains.lang.dart.ide.inspections.DartPathPackageReferenceInspection;
import com.jetbrains.lang.dart.util.DartResolveUtil;

import java.util.function.Consumer;
Expand All @@ -39,33 +34,6 @@ private void updateModuleRoots(Consumer<ContentEntry> contentEntryModifier) {
});
}

public void testScriptSrcPathToPackagesFolder() {
final String testName = getTestName(false);
myFixture.enableInspections(HtmlUnknownTargetInspection.class);

myFixture.addFileToProject("pubspec.yaml", """
name: ProjectName
dependencies:
PathPackage:
path: local_package
""");
myFixture.addFileToProject("lib/projectFile.dart", "");
myFixture.addFileToProject("local_package/lib/localPackageFile.html", "");
myFixture.addFileToProject("packages/browser/dart.js", "");
myFixture.configureByFile(testName + "/" + testName + ".html");
myFixture.checkHighlighting(true, false, true);
}

public void testScriptSrcPathToDotPackagesFile() {
myFixture.enableInspections(HtmlUnknownTargetInspection.class);
myFixture.addFileToProject("pubspec.yaml", "name: ProjectName");
myFixture.addFileToProject("local_package/lib/src/localPackageFile.html", "");
myFixture.addFileToProject(".packages", "PathPackage:local_package/lib/");
myFixture.configureByText("foo.html", "<link href=\"packages/PathPackage/src/localPackageFile.html\">\n" +
"<link href=\"packages/PathPackage/src/<warning descr=\"Cannot resolve file 'incorrect.html'\">incorrect.html</warning> \">");
myFixture.checkHighlighting(true, false, true);
}

public void testSpelling() {
myFixture.enableInspections(SpellCheckingInspection.class);
myFixture.configureByFile(getTestName(false) + ".dart");
Expand All @@ -83,38 +51,6 @@ public void testColorAnnotatorIdePart() {
myFixture.checkHighlighting(true, true, true);
}

public void testSimplePolymer() {
myFixture.enableInspections(HtmlUnknownTagInspection.class);
myFixture.addFileToProject("pubspec.yaml", """
name: ThisProject
dependencies:
PathPackage:
path: PathPackage
""");
myFixture.addFileToProject("lib/custom_element.html", "<polymer-element name='custom-element'/>");
myFixture.addFileToProject("PathPackage/lib/in_path_package.html", "<polymer-element name='path-package-element'/>");
addStandardPackage("polymer");
addStandardPackage("core_elements");
myFixture.configureByFile(getTestName(false) + "/web/" + getTestName(false) + ".html");
myFixture.checkHighlighting(true, false, true);
}

public void testPathPackageReferenceInspection() {
myFixture.enableInspections(new DartPathPackageReferenceInspection());
myFixture.copyDirectoryToProject(getTestName(false), "");
myFixture.openFileInEditor(ModuleRootManager.getInstance(getModule()).getContentRoots()[0].findChild("pubspec.yaml"));

ExpectedHighlightingData data = new ExpectedHighlightingData(myFixture.getEditor().getDocument(), true, true, false, false);
data.init();
((CodeInsightTestFixtureImpl)myFixture).collectAndCheckHighlighting(data);

updateModuleRoots((contentEntry) -> contentEntry.addExcludeFolder(contentEntry.getUrl() + "/other_project"));
((CodeInsightTestFixtureImpl)myFixture).collectAndCheckHighlighting(data);

updateModuleRoots((contentEntry) -> contentEntry.addSourceFolder(contentEntry.getUrl() + "/test", true));
((CodeInsightTestFixtureImpl)myFixture).collectAndCheckHighlighting(data);
}

public void testUriInPartOf() {
final PsiFile libFile = myFixture.addFileToProject("foo/bar/libFile.dart", "library libName;");
final PsiFile part1File = myFixture.addFileToProject("part1.dart", "part of 'part1.dart'"); // self reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,4 @@ private String toParseTreeText(PsiFile file) {
public void testHtmlInStrings() throws Exception {
doTest();
}

public void testRegExp() throws Exception {
Assume.assumeTrue("This test is not applicable in current environment because JavaScript plugin is not available",
Language.findLanguageByID("JSRegexp") != null);
doTest();
}

public void testJsonWithComment() throws Exception {
doTest();
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

38 changes: 0 additions & 38 deletions third_party/src/test/testData/injection/JsonWithComment.dart

This file was deleted.

Loading