Skip to content

Commit

Permalink
end template in tests as normal; if template was canceled - don't per…
Browse files Browse the repository at this point in the history
…form onSuccess method setup (IDEA-157973)
  • Loading branch information
akozlova committed Jul 8, 2016
1 parent 185b889 commit b88d3c2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public static void doCreate(PsiClass targetClass,
startTemplate(newEditor, template, project, new TemplateEditingAdapter() {
@Override
public void templateFinished(Template template, boolean brokenOff) {
if (brokenOff) return;
WriteCommandAction.runWriteCommandAction(project, () -> {
PsiDocumentManager.getInstance(project).commitDocument(newEditor.getDocument());
final int offset = newEditor.getCaretModel().getOffset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Usage {
PsiDocumentManager.getInstance(getFile().project).commitDocument(document)
}

state.gotoEnd()
state.gotoEnd(false)
}

public void "test prefer outer class when static is not applicable for inner"() {
Expand All @@ -153,7 +153,7 @@ class A {
PsiDocumentManager.getInstance(getFile().project).commitDocument(document)
}

state.gotoEnd()
state.gotoEnd(false)

checkResultByText """
class A {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private void startTemplate(final Editor editor,
}

if (shouldSkipInTests()) {
if (!templateState.isFinished()) templateState.gotoEnd();
if (!templateState.isFinished()) templateState.gotoEnd(false);
}
}

Expand Down

0 comments on commit b88d3c2

Please sign in to comment.