IDEA-81462 When live template has two parameters which appear on the same line, second disappears while first is being entered

This commit is contained in:
peter
2012-03-05 22:35:10 +04:00
parent f371c5d826
commit 1348b833a6
3 changed files with 33 additions and 24 deletions
@@ -267,7 +267,7 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase {
@Override
protected void invokeTestRunnable(final Runnable runnable) throws Exception {
if ("testNavigationActionsDontTerminateTemplate".equals(getName()) || "testTemplateWithEnd".equals(getName())) {
if (name in ["testNavigationActionsDontTerminateTemplate", "testTemplateWithEnd", "testDisappearingVar"]) {
runnable.run();
return;
}
@@ -375,4 +375,23 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase {
}
}
public void testUseDefaultValueForQuickResultCalculation() {
myFixture.configureByText 'a.txt', '<caret>'
final TemplateManager manager = TemplateManager.getInstance(getProject());
final Template template = manager.createTemplate("vn", "user", '$V1$ var = $V2$;');
template.addVariable("V1", "", "", true);
template.addVariable("V2", "", '"239"', true);
writeCommand { manager.startTemplate(editor, template) }
myFixture.checkResult '<caret> var = 239;'
myFixture.type 'O'
myFixture.checkResult 'O<caret> var = 239;'
myFixture.type '\t'
myFixture.checkResult 'O var = <selection>239</selection>;'
}
}