Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
300,700
|
void () { expand("ul>li*3>lipsum4"); XmlTag ul = PsiTreeUtil.findChildOfType(getFile(), XmlTag.class); assertNotNull(ul); XmlTag[] lis = ul.findSubTags("li"); assertEquals(3, lis.length); assertEquals("Lorem ipsum dolor sit.", lis[0].getValue().getText()); }
|
testLoremAsText
|
300,701
|
void () { expand("ul>lipsum2*5"); XmlTag ul = PsiTreeUtil.findChildOfType(getFile(), XmlTag.class); assertNotNull(ul); XmlTag[] lis = ul.findSubTags("li"); assertEquals(5, lis.length); assertEquals("Lorem ipsum.", lis[0].getValue().getText()); }
|
testLoremWithImplicitTagName
|
300,702
|
void () { expand("ul>lipsum2#ident"); XmlTag ul = PsiTreeUtil.findChildOfType(getFile(), XmlTag.class); assertNotNull(ul); XmlTag[] lis = ul.findSubTags("li"); assertEquals(1, lis.length); assertEquals("Lorem ipsum.", lis[0].getValue().getText()); assertEquals("ident", lis[0].getAttributeValue("id")); }
|
testLoremWithImplicitTagName2
|
300,703
|
void () { expand("ul>lorem2"); assertEquals("<ul>Lorem ipsum.</ul>", getFile().getText()); }
|
testLoremWithoutImplicitTagName
|
300,704
|
String () { return "html"; }
|
getExtension
|
300,705
|
void (String text, int expectedCount) { assertEquals(expectedCount, StringUtil.getWordsIn(text).size()); }
|
assertWordCount
|
300,706
|
void () { EmmetOptions.getInstance().setEmmetExpandShortcut(TemplateSettings.CUSTOM_CHAR); myFixture.configureByText(HtmlFileType.INSTANCE, "div.class*2<caret>"); myFixture.performEditorAction(IdeActions.ACTION_EXPAND_LIVE_TEMPLATE_CUSTOM); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UIUtil.dispatchAllInvocationEvents(); myFixture.checkResult("<div class=\"class\"></div>\n" + "<div class=\"class\"></div>"); }
|
testExpandWithCustomShortcut
|
300,707
|
void () { myFixture.configureByText(HtmlFileType.INSTANCE, "div.class*2<caret>"); myFixture.performEditorAction(IdeActions.ACTION_EXPAND_LIVE_TEMPLATE_CUSTOM); myFixture.checkResult("div.class*2<caret>"); }
|
testDoNotExpandWithCustomShortcut
|
300,708
|
void () { doTest("div*5", 55); }
|
testMulOperation
|
300,709
|
void () { doTest("lorem30", 210); }
|
testLorem
|
300,710
|
void () { doTest("div>div+div", 33); }
|
testAddOperation
|
300,711
|
void () { doTest("ul>li>span", 31); }
|
testMoreOperation
|
300,712
|
void () { doTest("div*2>li", 40); }
|
testMoreAfterMultiplyOperation
|
300,713
|
void () { doTest("div*2>li|s", 40); }
|
testFilter
|
300,714
|
void () { doTest("div>ul^ul", 29); }
|
testClimbUpOperation
|
300,715
|
void () { doTest("div[attr=val].class", 36); }
|
testTemplateWithAttributes
|
300,716
|
void (@NotNull String content, int expectedLength) { myFixture.configureByText(HtmlFileType.INSTANCE, content + "<caret>"); CustomTemplateCallback callback = new CustomTemplateCallback(myFixture.getEditor(), myFixture.getFile()); ZenCodingGenerator generator = findApplicableDefaultGenerator(callback, false); assertNotNull(generator); EmmetParser parser = new XmlEmmetParser(new EmmetLexer().lex(content), callback, generator, false); ZenCodingNode zenCodingNode = parser.parse(); assertNotNull(zenCodingNode); assertEquals(expectedLength, zenCodingNode.getApproximateOutputLength(callback)); }
|
doTest
|
300,717
|
void (String text) { expand(text, getExtension()); }
|
expand
|
300,718
|
void (String sourceData, String expectedData) { expand(sourceData, getExtension()); checkResultByText(expectedData); }
|
expandAndCheck
|
300,719
|
void (String selectedText, TemplateImpl template, String expectedResult) { configureFromFileText("text." + getExtension(), selectSourceData(selectedText)); ApplicationManager.getApplication().runWriteAction(() -> TemplateManager.getInstance(getProject()).startTemplate(getEditor(), selectedText, template)); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UIUtil.dispatchAllInvocationEvents(); checkResultByText(expectedResult); }
|
templateWrap
|
300,720
|
void (String text, String extension) { configureFromFileText("test." + extension, text); if (!text.contains(EditorTestUtil.CARET_TAG)) { end(); } ApplicationManager.getApplication().runWriteAction(() -> { TemplateManager.getInstance(getProject()).startTemplate(getEditor(), TemplateSettings.TAB_CHAR); }); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UIUtil.dispatchAllInvocationEvents(); }
|
expand
|
300,721
|
void (String sourceData, String emmetExpression, String expectedData) { configureFromFileText("test." + getExtension(), selectSourceData(sourceData)); final CustomTemplateCallback callback = new CustomTemplateCallback(getEditor(), getFile()); doWrap(emmetExpression, callback); TemplateState state; while ((state = TemplateManagerImpl.getTemplateState(getEditor())) != null) { state.nextTab(); } NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UIUtil.dispatchAllInvocationEvents(); checkResultByText(expectedData); }
|
emmetWrap
|
300,722
|
void (String sourceData, String emmetExpression, String expectedData) { configureFromFileText("test." + getExtension(), sourceData); EmmetAbbreviationBalloon.setTestingAbbreviation(emmetExpression, getTestRootDisposable()); executeAction(IdeActions.ACTION_UPDATE_TAG_WITH_EMMET); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UIUtil.dispatchAllInvocationEvents(); checkResultByText(expectedData); }
|
emmetUpdateTag
|
300,723
|
String (String sourceData) { return sourceData.contains(EditorTestUtil.SELECTION_START_TAG) ? sourceData : EditorTestUtil.SELECTION_START_TAG + sourceData + EditorTestUtil.SELECTION_END_TAG; }
|
selectSourceData
|
300,724
|
void (@NotNull String previewContent) { NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UIUtil.dispatchAllInvocationEvents(); EmmetPreviewHint previewHint = getPreview(); assertNotNull(previewHint); assertEquals(previewContent, previewHint.getContent()); }
|
assertPreview
|
300,725
|
EmmetPreviewHint () { return EmmetPreviewHint.getExistingHint(myFixture.getEditor()); }
|
getPreview
|
300,726
|
void () { emmetUpdateTag("<span class=\"c1 c2\" title=\"hello\"><caret></span>", ".-c2", "<span class=\"c1\" title=\"hello\"></span>"); }
|
testRemoveClass
|
300,727
|
void () { emmetUpdateTag("<span class=\"c1\" title=\"hello\"><caret></span>", ".+c3[-title a=b]", "<span class=\"c1 c3\" a=\"b\"></span>"); }
|
testAddClassAndModifyAttributes
|
300,728
|
void () { emmetUpdateTag("<span class=\"c1 c3\" a=\"b\"><caret></span>", "div.+c3[-a]", "<div class=\"c1 c3\"></div>"); }
|
testChangeTagName
|
300,729
|
void () { emmetUpdateTag("<div class=\"c1 c3\"><caret></div>", ".c$$$", "<div class=\"c000\"></div>"); }
|
testAddClassWithIterationPlaceholder
|
300,730
|
String () { return "html"; }
|
getExtension
|
300,731
|
String () { return Joiner.on(File.separatorChar).join(XmlTestUtil.getXmlTestDataPath(), "codeInsight", "template", "emmet", "performance"); }
|
getTestDataPath
|
300,732
|
void () { myFixture.configureByText("test.html", "di<caret>"); myFixture.type("v"); assertNull(getPreview()); }
|
testPrimitiveAbbreviation
|
300,733
|
void () { myFixture.configureByText("test.html", "div<caret>"); myFixture.type("."); assertNull(getPreview()); }
|
testPrimitiveAbbreviationWithEmptyClass
|
300,734
|
void () { myFixture.configureByText("test.html", "div.<caret>"); myFixture.type("c"); assertPreview("<div class=\"c\"></div>"); }
|
testAbbreviationWithNonEmptyClass
|
300,735
|
void () { myFixture.configureByText("test.html", "div>di<caret>"); myFixture.type("v"); assertPreview(""" <div> <div></div> </div>"""); }
|
testAbbreviationWithNesting
|
300,736
|
void () { myFixture.configureByText("test.html", "div#id>div.class<caret>"); myFixture.type("|c"); assertPreview(""" <div id="id"> <div class="class"></div> <!-- /.class --> </div> <!-- /#id -->"""); myFixture.type("|s"); assertPreview(""" <div id="id"> <div class="class"></div> <!-- /.class --> </div> <!-- /#id -->"""); }
|
testAbbreviationWithFilter
|
300,737
|
void () { myFixture.configureByText("test.xhtml", "div>b<caret>"); myFixture.type("r"); assertPreview("<div><br/></div>"); }
|
testPreviewXhtml
|
300,738
|
void () { doTest(); }
|
testChild
|
300,739
|
void () { doTest(); }
|
testClassAndId
|
300,740
|
void () { doTest(); }
|
testClimbUp1
|
300,741
|
void () { doTest(); }
|
testClimbUp2
|
300,742
|
void () { doTest(); }
|
testCustomAttributes
|
300,743
|
void () { doTest(); }
|
testDefaultAndBooleanAttributes
|
300,744
|
void () { doTest(); }
|
testEmptyAttributes
|
300,745
|
void () { doTest(); }
|
testGrouping
|
300,746
|
void () { doTest(); }
|
testGroups
|
300,747
|
void () { doTest(); }
|
testGroupsWithQuantifier
|
300,748
|
void () { doTest(); }
|
testImplicitTag1
|
300,749
|
void () { doTest(); }
|
testImplicitTag2
|
300,750
|
void () { doTest(); }
|
testImplicitTag3
|
300,751
|
void () { doTest(); }
|
testItemNumbering1
|
300,752
|
void () { doTest(); }
|
testItemNumbering2
|
300,753
|
void () { doTest(); }
|
testMoreAndClimbWithoutRightPart
|
300,754
|
void () { doTest(); }
|
testMultiplication
|
300,755
|
void () { doTest(); }
|
testMultiplicationInGroup
|
300,756
|
void () { doTest(); }
|
testPlusAndAdd
|
300,757
|
void () { doTest(); }
|
testSibling
|
300,758
|
void () { doTest(); }
|
testSimpleGroup
|
300,759
|
void () { doTest(); }
|
testText
|
300,760
|
void () { doTest(); }
|
testAttributeWithPlus
|
300,761
|
void () { doTest(); }
|
testAttributeWithMinus
|
300,762
|
void () { doTest("html"); }
|
doTest
|
300,763
|
void (@NotNull String extension) { configureByFile(getTestName(true) + "." + extension); CustomTemplateCallback callback = new CustomTemplateCallback(getEditor(), getFile()); ZenCodingGenerator generator = findApplicableDefaultGenerator(callback, false); assertNotNull(generator); EmmetParser parser = new XmlEmmetParser(new EmmetLexer().lex(getFile().getText()), callback, generator, false); final ZenCodingNode parseResult = parser.parse(); assertNotNull("Cannot parse input data", parseResult); assertSameLinesWithFile(getTestDataPath() + getTestName(true) + ".txt", nodeToString(parseResult, 0)); }
|
doTest
|
300,764
|
String (@NotNull ZenCodingNode zenCodingNode, int level) { StringBuilder result = new StringBuilder(); result.append(StringUtil.repeatSymbol(' ', level * 2)); result.append(zenCodingNode.toString()).append("\n"); for (ZenCodingNode node : zenCodingNode.getChildren()) { result.append(nodeToString(node, level + 1)); } if (zenCodingNode instanceof FilterNode) { result.append(nodeToString(((FilterNode)zenCodingNode).getNode(), level + 1)); } if (zenCodingNode instanceof MulOperationNode) { result.append(nodeToString(((MulOperationNode)zenCodingNode).getLeftOperand(), level + 1)); result.append(StringUtil.repeatSymbol(' ', (level + 1) * 2)); result.append(((MulOperationNode)zenCodingNode).getRightOperand()).append("\n"); } if (zenCodingNode instanceof UnaryMulOperationNode) { result.append(nodeToString(((UnaryMulOperationNode)zenCodingNode).getOperand(), level + 1)); } return result.toString(); }
|
nodeToString
|
300,765
|
String () { return XmlTestUtil.getXmlTestDataPath() + "/codeInsight/template/emmet/parser/"; }
|
getTestDataPath
|
300,766
|
void (String source, String expected, String... extensions) { addTest(source, expected, null, extensions); }
|
addTest
|
300,767
|
void (String source, String expected, @Nullable TestInitializer setUp, String... extensions) { for (String extension : extensions) { super.addTest(new EmmetAbbreviation(source, expected, extension, false, setUp) {}); } }
|
addTest
|
300,768
|
void (String source, String expected, String... extensions) { addTestWithPositionCheck(source, expected, null, extensions); }
|
addTestWithPositionCheck
|
300,769
|
void (String source, String expected, @Nullable TestInitializer setUp, String... extensions) { for (String extension : extensions) { super.addTest(new EmmetAbbreviation(source, expected, extension, true, setUp) {}); } }
|
addTestWithPositionCheck
|
300,770
|
String () { return getClass().getName(); }
|
getName
|
300,771
|
TestInitializer (CodeStyleSettings.QuoteStyle newStyle) { return (fixture, testRootDisposable) -> EmmetAbbreviationTestSuite.getHtmlSettings(fixture).HTML_QUOTE_STYLE = newStyle; }
|
quoteStyle
|
300,772
|
HtmlCodeStyleSettings (CodeInsightTestFixture fixture) { return CodeStyle.getSettings(fixture.getProject()).getCustomSettings(HtmlCodeStyleSettings.class); }
|
getHtmlSettings
|
300,773
|
void (@NotNull ThrowableRunnable<Throwable> testRunnable) { String expectedText = !expectedData.contains(EditorTestUtil.CARET_TAG) ? prepareExpectedText(expectedData) : expectedData; prepareEditorForTest(sourceData, extension); expandAndReformat(true); myFixture.checkResult(expectedText); if (myCheckPosition) { assertEquals(expectedTabStops, actualTabStops); //check placeholders } }
|
runTestRunnable
|
300,774
|
void (final boolean actualCode) { Project project = getProject(); assertNotNull(project); EditorAction action = (EditorAction)ActionManager.getInstance().getAction(IdeActions.ACTION_EXPAND_LIVE_TEMPLATE_BY_TAB); action.actionPerformed(myFixture.getEditor(), DataManager.getInstance().getDataContext()); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UIUtil.dispatchAllInvocationEvents(); WriteCommandAction.runWriteCommandAction(getProject(), () -> { TemplateState state = TemplateManagerImpl.getTemplateState(myFixture.getEditor()); Editor editor = InjectedLanguageUtil.getTopLevelEditor(myFixture.getEditor()); while (state != null && !state.isFinished()) { if (actualCode) { actualTabStops.add(editor.getCaretModel().getOffset()); } state.nextTab(); } if (actualCode) { actualTabStops.add(editor.getCaretModel().getOffset()); } CodeStyleManager.getInstance(project).reformat(myFixture.getFile()); }); }
|
expandAndReformat
|
300,775
|
String (String expectedData) { int index; while ((index = expectedData.indexOf('|')) > -1) { expectedData = expectedData.substring(0, index) + expectedData.substring(index + 1); expectedTabStops.add(index); } myFixture.configureByText("expected." + extension, expectedData); end(); expandAndReformat(false); return myFixture.getFile().getText(); }
|
prepareExpectedText
|
300,776
|
void (String sourceText, String extension) { myFixture.configureByText("test." + extension, sourceText); if (!sourceText.contains(EditorTestUtil.CARET_TAG)) { end(); } }
|
prepareEditorForTest
|
300,777
|
void () { myFixture.performEditorAction(IdeActions.ACTION_EDITOR_MOVE_LINE_END); }
|
end
|
300,778
|
String () { return (sourceData + " in " + extension).replace('\n', ' ').replaceAll(" ", ""); }
|
toString
|
300,779
|
String () { return toString(); }
|
getName
|
300,780
|
String (boolean lowercaseFirstLetter) { return ""; }
|
getTestName
|
300,781
|
void () { emmetWrap("Hello world!", "a", "<a href=\"\">Hello world!</a>"); }
|
testText
|
300,782
|
void () { emmetWrap("<h3>Hello world!</h3>", "a", "<a href=\"\"><h3>Hello world!</h3></a>"); }
|
testWrapTag
|
300,783
|
void () { emmetWrap("<h3><selection><!--Hello world!--></selection></h3>", "a", "<h3><a href=\"\"><!--Hello world!--></a></h3>"); }
|
testWrapComment
|
300,784
|
void () { emmetWrap("<span><selection>SA.</selection></span>", "div", "<span><div>SA.</div></span>"); }
|
testWrapText
|
300,785
|
void () { emmetWrap(""" <selection>one two three </selection>""", "div", """ <div><caret>one two three </div>"""); }
|
testFormatting
|
300,786
|
void () { emmetWrap("<selection>hello </selection>world", "b", "<b>hello </b>world"); }
|
testDoNoTrimSelection
|
300,787
|
void () { emmetWrap(""" <div id="testid"> <selection> <p>par</p> </selection></div>""", "first>span.cls>h1{text}+span.cls2", """ <div id="testid"> <first><span class="cls"> <h1>text</h1> <span class="cls2"><p>par</p></span></span></first> </div>"""); }
|
_testFormattingWeb6563
|
300,788
|
void () { addSelectionTemplate("dquo", "“$SELECTION$”$END$"); expandAndCheck("dquo", "“<caret>”"); }
|
testExpandAbbreviationWithSelectionAndEndVariables
|
300,789
|
void () { final TemplateImpl template = addSelectionTemplate("dquo", "“$SELECTION$”$END$"); templateWrap("text", template, "“text”<caret>"); }
|
testWrapAbbreviationWithSelectionAndEndVariables
|
300,790
|
void () { addSelectionTemplate("dquo", "“$SELECTION$”"); expandAndCheck("dquo", "“<caret>”"); }
|
testExpandAbbreviationWithSelectionVariable
|
300,791
|
void () { final TemplateImpl template = addSelectionTemplate("dquo", "“$SELECTION$”"); templateWrap("text", template, "<caret>“text”"); }
|
testWrapAbbreviationWithSelectionVariable
|
300,792
|
void () { emmetWrap(""" <selection><caret><div></div></selection> <selection><caret><div></div></selection>""", "div", """ <div><caret> <div></div> </div> <div><caret> <div></div> </div>"""); }
|
testMultiCaretWrapping
|
300,793
|
void () { emmetWrap(""" <selection><caret>link text</selection> <selection><caret>other link text</selection>""", "a", """ <a href="<caret>">link text</a> <a href="<caret>">other link text</a>"""); }
|
testMultiCaretWrappingShouldStopAtFirstVariable
|
300,794
|
void () { emmetWrap("http://emmet.io", "a", "<a href=\"http://emmet.io\">http://emmet.io</a>"); emmetWrap("www.emmet.io", "a", "<a href=\"http://www.emmet.io\">www.emmet.io</a>"); emmetWrap("emmet.io", "a", "<a href=\"\">emmet.io</a>"); emmetWrap("info@emmet.io", "a", "<a href=\"mailto:info@emmet.io\">info@emmet.io</a>"); }
|
testWrapUrlLikeContent
|
300,795
|
String () { return "html"; }
|
getExtension
|
300,796
|
TemplateImpl (String key, String text) { final TemplateManager manager = TemplateManager.getInstance(getProject()); TemplateImpl templateImpl = (TemplateImpl)manager.createTemplate(key, "html", text); templateImpl.addVariable(TemplateImpl.SELECTION, "", "", false); TemplateContext context = templateImpl.getTemplateContext(); context.setEnabled(TemplateContextTypes.getByClass(HtmlContextType.class), true); CodeInsightTestUtil.addTemplate(templateImpl, getTestRootDisposable()); return templateImpl; }
|
addSelectionTemplate
|
300,797
|
void () { String lorem = new LoremGenerator().generate(10, true); assertEquals(10, StringUtil.getWordsIn(lorem).size()); }
|
testGenerate10Words
|
300,798
|
void () { String lorem = new LoremGenerator().generate(30, true); assertEquals(30, StringUtil.getWordsIn(lorem).size()); }
|
testGenerate30Words
|
300,799
|
void () { String lorem = new LoremGenerator().generate(10, true).toLowerCase(); List<String> wordsIn = StringUtil.getWordsIn(lorem); Sets.SetView<String> difference = Sets.difference(Sets.newHashSet(LoremGenerator.COMMON_P), Sets.newHashSet(wordsIn)); assertTrue("Following words were not used in lorem: " + difference.toString(), difference.isEmpty()); }
|
testCommonStart
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.