Skip to content

Commit

Permalink
Emmet: use language instead of file type while creating file in order to
Browse files Browse the repository at this point in the history
avoid language substitutors
  • Loading branch information
zolotov authored and dmarcotte committed Jul 26, 2015
1 parent 15f8f49 commit 7430f93
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.dmarcotte.handlebars.editor.templates;

import com.dmarcotte.handlebars.file.HbFileType;
import com.dmarcotte.handlebars.psi.HbPsiFile;
import com.dmarcotte.handlebars.util.HbTestUtils;
import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.codeInsight.template.impl.TemplateSettings;
import com.intellij.psi.PsiFile;
import com.intellij.testFramework.PlatformTestCase;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;

public class HbsEmmetTest extends LightPlatformCodeInsightFixtureTestCase {

@Override
protected void setUp() throws Exception {
PlatformTestCase.initPlatformLangPrefix();
super.setUp();
}

public void testSimpleTags() {
myFixture.configureByText(HbFileType.INSTANCE, "div>span<caret>");
TemplateManager.getInstance(getProject()).startTemplate(myFixture.getEditor(), TemplateSettings.TAB_CHAR);
myFixture.checkResult("<div><span></span></div>");
}

public void testSimpleTagsWithHtmlSubstitutor() {
HbTestUtils.setOpenHtmlAsHandlebars(true, getProject(), getTestRootDisposable());
final PsiFile file = myFixture.configureByText("test.html", "div>span<caret>");
assertInstanceOf(file, HbPsiFile.class);
TemplateManager.getInstance(getProject()).startTemplate(myFixture.getEditor(), TemplateSettings.TAB_CHAR);
myFixture.checkResult("<div><span></span></div>");
}
}

0 comments on commit 7430f93

Please sign in to comment.