Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
|---|---|---|
300,100
|
void () { String attributes = "attr1=\"value1\" arre2=\"value2\""; final String tagPresentation = "a " + attributes; final String tagText = "<" + tagPresentation + "/>"; XmlTag xmlTag = XmlElementFactory.getInstance(getProject()).createTagFromText(tagText); final XmlTagTreeElement treeElement = new XmlTagTreeElement(xmlTag); assertEquals(xmlTag.getName(), treeElement.getPresentableText()); assertEquals(attributes, treeElement.getLocationString()); }
|
test
|
300,101
|
void () { doTest("file1.xml", """ XmlFile:file1.xml XmlTag:root XmlTag:a XmlTag:a XmlTag:b XmlTag:text """ ); }
|
testXmlStructureView
|
300,102
|
void () { doTest("file1.dtd", """ XmlFile:file1.dtd book draft final helpset (file:required, path:required) myplugin (url:implied, version:implied) price """); doTest("file2.dtd", """ XmlFile:file2.dtd HTMLlat1 nbsp """); }
|
testDtdStructureView
|
300,103
|
void () { final String fileName = "file2.xml"; final String s = """ XmlFile:file2.xml body supplements title XmlTag:title """; doTest(fileName, s); }
|
testDtdStructureViewInXml
|
300,104
|
void () { doTest( getTestName(false) + ".html", """ HtmlFile:HtmlCustomRegions.html Region 'A' HtmlTag:div HtmlTag:div Region 'B' HtmlTag:ul Region 'C' HtmlTag:li HtmlTag:li HtmlTag:li HtmlTag:div """); }
|
testHtmlCustomRegions
|
300,105
|
void (final String fileName, final String s) { XmlFile xmlFile = (XmlFile)getContentDirectory().findFile(fileName); VirtualFile virtualFile = xmlFile.getVirtualFile(); final StructureViewBuilder structureViewBuilder = StructureViewBuilder.PROVIDER.getStructureViewBuilder(virtualFile.getFileType(), virtualFile, myProject); StructureViewModel viewModel = ((TreeBasedStructureViewBuilder)structureViewBuilder).createStructureViewModel(null); try { AbstractTreeStructure structure = new SmartTreeStructure(myProject, viewModel); checkNavigatability(structure.getRootElement()); ProjectViewTestUtil.assertStructureEqual(structure, s, null); } finally { Disposer.dispose(viewModel); } }
|
doTest
|
300,106
|
void (final Object _element) { AbstractTreeNode element = (AbstractTreeNode)_element; assertTrue(element.canNavigate()); for(Object c:element.getChildren()) checkNavigatability(c); }
|
checkNavigatability
|
300,107
|
String () { return "xmlStructureView"; }
|
getTestDirectoryName
|
300,108
|
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/"; }
|
getTestDataPath
|
300,109
|
String () { return "/xml/tests/testData/microdata/"; }
|
getBasePath
|
300,110
|
boolean () { return true; }
|
isCommunity
|
300,111
|
void (String text, String... items) { configureAndComplete(text); assertContainsElements(myFixture.getLookupElementStrings(), Arrays.asList(items)); }
|
doTestInHtml
|
300,112
|
void (String text, String... items) { configureAndComplete(text); final List<String> lookups = myFixture.getLookupElementStrings(); assertNotNull(lookups); for (String item : items) { assertFalse("Should not contain: " + item, lookups.contains(item)); } }
|
doFailTestInHtml
|
300,113
|
void (String text) { myFixture.configureByText(HtmlFileType.INSTANCE, text); myFixture.complete(CompletionType.BASIC); }
|
configureAndComplete
|
300,114
|
void () { doTestInHtml("<section <caret>></section>", "itemscope"); }
|
testScopeType
|
300,115
|
void () { doTestInHtml("<div <caret>></div>", "itemscope"); }
|
testScopeInDivTag
|
300,116
|
void () { doTestInHtml("<span <caret>></span>", "itemscope"); }
|
testScopeInSpanTag
|
300,117
|
void () { doTestInHtml("<a <caret>></a>", "itemscope"); }
|
testScopeInATag
|
300,118
|
void () { doFailTestInHtml("<a <caret>></a>", "itemtype", "itemid"); }
|
_testTypeInATag
|
300,119
|
void () { doTestInHtml("<section itemscope <caret>><div></div></section>", "itemtype", "itemid"); }
|
testTypeInScope
|
300,120
|
void () { doTestInHtml("<section itemscope><div <caret>></div></section>", "itemprop"); }
|
testPropInScope
|
300,121
|
void () { doFailTestInHtml("<section <caret>><div></div></section>", "itemtype", "itemid"); }
|
_testTypeWithinScope
|
300,122
|
void () { doFailTestInHtml("<section><div <caret>></div></section>", "itemprop"); }
|
_testPropWithinScope
|
300,123
|
void () { doTestInHtml("<body>" + "<section itemscope itemref=\"bar foo\"></section>" + "<section id=\"foo\"><div <caret>></div></section>" + "</body>", "itemprop"); }
|
testPropWithinScopeWithRef
|
300,124
|
void () { doTestInHtml("<section itemscope itemref=\"b<caret>\"></section><p id=\"bar\"></p><p id=\"baz\"></p>", "bar", "baz"); }
|
testRefInScope
|
300,125
|
void () { final VirtualFile virtualFile = myFixture.copyFileToProject("Person.html"); ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Person", virtualFile.getPath(), getTestRootDisposable()); doTestInHtml("<section itemscope itemtype=\"http://data-vocabulary.org/Person\"><div itemprop=\"<caret>\"></div></section>", "name", "nickname", "photo", "title", "role", "url", "affiliation", "friend", "acquaintance", "address" ); }
|
testPropValue
|
300,126
|
void () { final VirtualFile virtualFile = myFixture.copyFileToProject("Product.html"); ExternalResourceManagerExImpl.registerResourceTemporarily("http://schema.org/Product", virtualFile.getPath(), getTestRootDisposable()); doTestInHtml("<section itemscope itemtype=\"http://schema.org/Product\"><div itemprop=\"<caret>\"></div></section>", "additionalType", "aggregateRating", "brand", "color", "depth", "description", "gtin13", "gtin14", "gtin8", "height", "image", "isAccessoryOrSparePartFor", "isConsumableFor", "isRelatedTo", "isSimilarTo", "itemCondition", "logo", "manufacturer", "model", "mpn", "name", "offers", "productID", "releaseDate", "review", "reviews", "sku", "url", "weight", "width" ); }
|
testPropValueSchemaOrgFormat
|
300,127
|
void () { final VirtualFile virtualFile = myFixture.copyFileToProject("Rating.html"); ExternalResourceManagerExImpl.registerResourceTemporarily("http://schema.org/Rating", virtualFile.getPath(), getTestRootDisposable()); doTestInHtml("<section itemscope itemtype=\"http://schema.org/Rating\"><div itemprop=\"<caret>\"></div></section>", "alternateName", "bestRating", "description", "image", "name", "potentialAction", "ratingValue", "reviewRating", "sameAs", "url", "worstRating" ); }
|
testPropValueSchemaOrgFormatWithLinks
|
300,128
|
void () { final VirtualFile personFile = myFixture.copyFileToProject("Person.html"); final VirtualFile addressFile = myFixture.copyFileToProject("Address.html"); ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Person", personFile.getPath(), getTestRootDisposable()); ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Address", addressFile.getPath(), getTestRootDisposable()); doTestInHtml( "<section itemscope itemtype=\"http://data-vocabulary.org/Person http://data-vocabulary.org/Address\"><div itemprop=\"<caret>\"></div></section>", "name", "nickname", "photo", "title", "role", "url", "affiliation", "friend", "acquaintance", "address", "street-address", "locality", "region", "postal-code", "country-name" ); }
|
testPropValueFromTwoTypes
|
300,129
|
void () { final VirtualFile virtualFile = myFixture.copyFileToProject("Person.html"); ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Person", virtualFile.getPath(), getTestRootDisposable()); doTestInHtml("<body>" + "<section itemscope itemtype=\"http://data-vocabulary.org/Person\" itemref=\"foo\"></section>" + "<section id=\"foo\"><div itemprop=\"<caret>\"></div></section>" + "</body>", "name", "nickname", "photo", "title", "role", "url", "affiliation", "friend", "acquaintance", "address" ); }
|
testPropValueFromRef
|
300,130
|
void () { final VirtualFile personFile = myFixture.copyFileToProject("Person.html"); final VirtualFile addressFile = myFixture.copyFileToProject("Address.html"); ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Person", personFile.getPath(), getTestRootDisposable()); ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Address", addressFile.getPath(), getTestRootDisposable()); doTestInHtml(""" <div itemscope itemtype="http://data-vocabulary.org/Person"> My name is <span itemprop="name">Smith</span> <span itemprop="<caret>" itemscope itemtype="http://data-vocabulary.org/Address"> <span itemprop="locality">Albuquerque</span> <span itemprop="region">NM</span> </span> </div>""", "name", "nickname", "photo", "title", "role", "url", "affiliation", "friend", "acquaintance", "address" ); }
|
testPropValueNestedScopes
|
300,131
|
void () { final VirtualFile personFile = myFixture.copyFileToProject("Person.html"); final VirtualFile addressFile = myFixture.copyFileToProject("Address.html"); ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Person", personFile.getPath(), getTestRootDisposable()); ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Address", addressFile.getPath(), getTestRootDisposable()); doTestInHtml(""" <div itemscope itemtype="http://data-vocabulary.org/Person" > name is <span itemprop="name">ann</span> role is <span itemprop="role">smth</span> <span itemprop="address" itemscope itemtype="http://data-vocabulary.org/Address" itemref="qq"> <span itemprop="locality">spb</span> </span> </div> <div> <span id="qq" itemprop="<caret>">russia</span> </div>""", "street-address", "locality", "region", "postal-code", "country-name" ); }
|
testPropValueNestedScopesDifferentTrees
|
300,132
|
void () { throw new AssumptionViolatedException("disable"); }
|
testDtdUrl1
|
300,133
|
void () { throw new AssumptionViolatedException("disable"); }
|
testCustomMimeType
|
300,134
|
void () { doTest(""" <!DOCTYPE html> <html> <bo<caret>dy onload=""> </body> </html>""", "<div class='definition'><pre>body</pre></div>\n<div class='content'>" + "The <strong><code><body></code></strong> <a href=\"https://developer.mozilla.org/en-us/docs/Web/HTML\">HTML</a> " + "element represents the content of", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/html/element/body")); }
|
testQuickDocumentationHtml5Tag
|
300,135
|
void () { doTest(""" <!DOCTYPE html> <html> <body onload=""> <dia<caret>log></dialog </body> </html>""", "<div class='definition'><pre>dialog</pre></div>\n<div class='content'>" + "The <strong><code><dialog></code></strong> <a href=\"https://developer.mozilla.org/en-us/docs/Web/HTML\">HTML</a> " + "element represents a dialog box", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/html/element/dialog")); }
|
testQuickDocumentationHtml5TagDialog
|
300,136
|
void () { doTest(""" <!DOCTYPE html> <html> <body on<caret>load=""> </body> </html>""", "<div class='definition'><pre>onload</pre></div>\n<div class='content'>Function to call when the document has finished loading.", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/html/element/body#onload")); }
|
testQuickDocumentationHtml5Attr
|
300,137
|
void () { doTest(""" <!DOCTYPE html> <html> <body> <sv<caret>g> </svg> </body> </html>""", "<div class='definition'><pre>svg</pre></div>\n<div class='content'>" + "The <code>svg</code> element is a container that defines a new coordinate system and", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/svg/element/svg")); }
|
testQuickDocumentationHtml5Svg
|
300,138
|
void () { doTest(""" <!DOCTYPE html> <html> <body> <svg> <ima<caret>ge> </image> </svg> </body> </html>""", "<div class='definition'><pre>image</pre></div>\n<div class='content'>" + "The <strong><code><image></code></strong> SVG element includes images inside SVG documents.", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/svg/element/image")); }
|
testQuickDocumentationHtml5SvgImage
|
300,139
|
void () { doTest(""" <!DOCTYPE html> <html> <body> <ma<caret>th> </math> </body> </html>""", "<div class='definition'><pre>math</pre></div>\n<div class='content'>" + "The <strong><code><math></code></strong> <a href=\"https://developer.mozilla.org/en-us/docs/Web/MathML\">MathML</a> " + "element is the top-level MathML element", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/mathml/element/math")); }
|
testQuickDocumentationHtml5Math
|
300,140
|
void () { doTest(""" <!DOCTYPE html> <html> <body> <math> <mr<caret>ow> </mrow> </math> </body> </html>""", "<div class='definition'><pre>mrow</pre></div>\n<div class='content'>" + "The <strong><code><mrow></code></strong> <a href=\"https://developer.mozilla.org/en-us/docs/Web/MathML\">MathML</a> " + "element is used to group sub-expressions", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/mathml/element/mrow")); }
|
testQuickDocumentationHtml5MathMrow
|
300,141
|
void () { doTest(""" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <bo<caret>dy onload=""> </body> </html>""", "<div class='definition'><pre>body</pre></div>\n<div class='content'>" + "The <strong><code><body></code></strong> <a href=\"https://developer.mozilla.org/en-us/docs/Web/HTML\">HTML</a> " + "element represents the content of an HTML document.", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/html/element/body")); }
|
testQuickDocumentationHtml4Tag
|
300,142
|
void () { doTest(""" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <body on<caret>load=""> </body> </html>""", "<div class='definition'><pre>onload</pre></div>\n<div class='content'>Function to call when the document has finished loading.", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/html/element/body#onload")); }
|
testQuickDocumentationHtml4Attr
|
300,143
|
void () { doTest("<scr<caret>ipt></script>", "<div class='definition'><pre>script</pre></div>\n<div class='content'>" + "The <strong><code><script></code></strong> <a href=\"https://developer.mozilla.org/en-us/docs/Web/HTML\">HTML</a> " + "element is used to embed executable", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/html/element/script")); }
|
testQuickDocumentationHtml5Script
|
300,144
|
void () { doTest("<video on<caret>stalled=''>", "<div class='definition'><pre>onstalled</pre></div>\n<div class='content'>" + "The <code>stalled</code> event is fired when the user agent is trying to fetch media data", Collections.singletonList("https://developer.mozilla.org/en-us/docs/web/api/htmlmediaelement/stalled_event")); }
|
testQuickDocumentationHtml5MediaEvents
|
300,145
|
void () { myFixture.configureByText("test.html", "<html lang='en'>la<caret>n"); PsiElement originalElement = myFixture.getFile().findElementAt(myFixture.getEditor().getCaretModel().getOffset()); DocumentationProvider documentationProvider = DocumentationManager.getProviderFromElement(originalElement); PsiElement element = documentationProvider.getDocumentationElementForLookupItem(originalElement.getManager(), "lang", originalElement); assertNull(element); }
|
testLookupDocWordCompletions
|
300,146
|
void (String text, String doc, List<String> url) { myFixture.configureByText("test.html", text); PsiElement originalElement = myFixture.getFile().findElementAt(myFixture.getEditor().getCaretModel().getOffset()); PsiElement element = DocumentationManager.getInstance(getProject()).findTargetElement(myFixture.getEditor(), myFixture.getFile()); DocumentationProvider documentationProvider = DocumentationManager.getProviderFromElement(originalElement); String generatedDoc = documentationProvider.generateDoc(element, originalElement); if (generatedDoc == null) { //noinspection ConstantConditions assertEquals(doc, generatedDoc); } else if (doc == null || !generatedDoc.startsWith(doc)) { throw new ComparisonFailure("Generated doc doesn't start with correct prefix", doc, generatedDoc); } assertEquals(url, documentationProvider.getUrlFor(element, originalElement)); }
|
doTest
|
300,147
|
void () { highlightTest("<html><body><img></body></html>"); }
|
testImgElement
|
300,148
|
void () { highlightTest("<html><table><error descr=\"Element table is not closed\"><</error>/html>"); }
|
testIncompleteElement
|
300,149
|
void () { quickfixTest("<html><<warning descr=\"Element <p> is missing an end tag\">p</warning><caret>>Behold!</html>", "<html><p>Behold!</p></html>", "Add </p>"); }
|
testPElement
|
300,150
|
void () { highlightTest("<html><body><App/></body></html>"); }
|
testCollapsedEmptyTag
|
300,151
|
LocalInspectionTool () { return new HtmlMissingClosingTagInspection(); }
|
getInspection
|
300,152
|
IntentionAction (@NotNull final String hint) { final List<IntentionAction> allIntentions = myFixture.getAvailableIntentions(); final List<IntentionAction> intentions = allIntentions.stream().filter(action -> action.getText().startsWith(hint)).limit(2).toList(); Assert.assertFalse("\"" + hint + "\" not in " + intentions, intentions.isEmpty()); Assert.assertFalse("Too many quickfixes found for \"" + hint + "\": " + intentions + "]", intentions.size() > 1); return intentions.get(0); }
|
findIntention
|
300,153
|
void () { quickfixTest("<textarea wrap='hard'></textarea><textarea wrap='<warning descr=\"Wrong attribute value\">me<caret>dium</warning>'></textarea>", "<textarea wrap='hard'></textarea><textarea wrap='hard'></textarea>"); }
|
testTextareaElement
|
300,154
|
void () { quickfixTest("<svg><g font-style='normal'/><g font-style='<warning descr=\"Wrong attribute value\">ob<caret>liq</warning>'></g></svg>", "<svg><g font-style='normal'/><g font-style='oblique'></g></svg>"); }
|
testSvgGElement
|
300,155
|
void () { highlightTest("<textarea wrap='<warning descr=\"Wrong attribute value\">medium</warning>'></textarea>" + "<div><!--suppress HtmlWrongAttributeValue--><textarea wrap='medium'></textarea></div>"); }
|
testSuppression
|
300,156
|
LocalInspectionTool () { return new HtmlWrongAttributeValueInspection(); }
|
getInspection
|
300,157
|
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/"; }
|
getTestDataPath
|
300,158
|
void () { String value = "<a><b c=\"\" > </b> </a>"; final CompositeElement element = parseManually(value, XmlElementType.XML_ELEMENT_DECL, XmlEntityDecl.EntityContextType.GENERIC_XML); checkResult("testManualEmptyAttributeParsing.txt", DebugUtil.treeToString(element, true)); }
|
testManualEmptyAttributeParsing
|
300,159
|
CompositeElement (final String value, final IElementType xmlElementDecl, XmlEntityDecl.EntityContextType parseType) { return (CompositeElement)new DtdParsing(value, xmlElementDecl, parseType, null).parse(); }
|
parseManually
|
300,160
|
void () { String s = "| %pre.qname; | %blockquote.qname; | %address.qname;"; CompositeElement element = parseManually(s, XmlElementType.XML_ELEMENT_CONTENT_SPEC, XmlEntityDecl.EntityContextType.ELEMENT_CONTENT_SPEC); checkResult("testEntityDeclaration2.txt", DebugUtil.treeToString(element, true)); }
|
testEntityDeclaration2
|
300,161
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor("<!ELEMENT principals (#PCDATA)><!ELEMENT data-sources (#PCDATA)>"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag("principals")); assertNotNull(elementDescriptor); elementDescriptor = NSDescriptor.getElementDescriptor(tag("data-sources")); assertNotNull(elementDescriptor); elementDescriptor = NSDescriptor.getElementDescriptor(tag("xxx")); assertNull(elementDescriptor); }
|
testDocumentDescriptor1
|
300,162
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor("<!ELEMENT principals (#PCDATA)><!ELEMENT data-sources (#PCDATA)>"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag("principals")); assertEquals("principals", elementDescriptor.getName()); elementDescriptor = NSDescriptor.getElementDescriptor(tag("data-sources")); assertEquals("data-sources", elementDescriptor.getName()); }
|
testElementDescriptor1
|
300,163
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ELEMENT principals (#PCDATA)><!ELEMENT data-sources ANY>" + "<!ELEMENT read-access (namespace-resource)><!ELEMENT group EMPTY>"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag("principals")); assertEquals(elementDescriptor.getContentType(), XmlElementDescriptor.CONTENT_TYPE_MIXED); elementDescriptor = NSDescriptor.getElementDescriptor(tag("data-sources")); assertEquals(elementDescriptor.getContentType(), XmlElementDescriptor.CONTENT_TYPE_ANY); elementDescriptor = NSDescriptor.getElementDescriptor(tag("read-access")); assertEquals(elementDescriptor.getContentType(), XmlElementDescriptor.CONTENT_TYPE_CHILDREN); elementDescriptor = NSDescriptor.getElementDescriptor(tag("group")); assertEquals(elementDescriptor.getContentType(), XmlElementDescriptor.CONTENT_TYPE_EMPTY); }
|
testElementDescriptor2
|
300,164
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ELEMENT principals ANY><!ATTLIST principals path CDATA #IMPLIED smtp-host CDATA #REQUIRED>" + "<!ATTLIST principals address CDATA #IMPLIED>"); final XmlTag tag = tag("principals"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("path", tag); assertNotNull(attributeDescriptor); attributeDescriptor = elementDescriptor.getAttributeDescriptor("xxx", tag); assertNull(attributeDescriptor); attributeDescriptor = elementDescriptor.getAttributeDescriptor("smtp-host", tag); assertNotNull(attributeDescriptor); attributeDescriptor = elementDescriptor.getAttributeDescriptor("address", tag); assertNotNull(attributeDescriptor); XmlAttributeDescriptor[] descriptors = elementDescriptor.getAttributesDescriptors(tag); assertEquals("path", descriptors[0].getName()); assertEquals("smtp-host", descriptors[1].getName()); assertEquals("address", descriptors[2].getName()); assertEquals(3, descriptors.length); }
|
testElementDescriptor3
|
300,165
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ELEMENT orion-application (ejb-module*, persistence?, namespace-access)>" + "<!ELEMENT ejb-module ANY>" + "<!ELEMENT persistence ANY>" + "<!ELEMENT namespace-access ANY>"); XmlTag documentTag = tag("orion-application"); XmlElementDescriptorImpl elementDescriptor = (XmlElementDescriptorImpl)NSDescriptor.getElementDescriptor(documentTag); XmlElementDescriptor[] elements = elementDescriptor.getElementsDescriptors(documentTag); assertEquals(3, elements.length); assertEquals("ejb-module", elements[0].getName()); assertEquals("persistence", elements[1].getName()); assertEquals("namespace-access", elements[2].getName()); elements = elements[0].getElementsDescriptors(documentTag); assertEquals(4, elements.length); assertEquals("orion-application", elements[0].getName()); assertEquals("ejb-module", elements[1].getName()); assertEquals("persistence", elements[2].getName()); assertEquals("namespace-access", elements[3].getName()); }
|
testElementDescriptor4
|
300,166
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ELEMENT principals ANY><!ATTLIST principals path CDATA #IMPLIED>"); final XmlTag tag = tag("principals"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("path", tag); assertEquals("path", attributeDescriptor.getName()); assertTrue(!attributeDescriptor.isRequired()); assertTrue(!attributeDescriptor.isFixed()); assertTrue(!attributeDescriptor.isEnumerated()); assertNull(attributeDescriptor.getDefaultValue()); }
|
testAttributeDescriptor1
|
300,167
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ELEMENT principals ANY><!ATTLIST principals path CDATA #IMPLIED>"); final XmlTag tag = tag("principals"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("path", tag); assertTrue(!attributeDescriptor.isRequired()); assertTrue(!attributeDescriptor.isFixed()); assertTrue(!attributeDescriptor.isEnumerated()); assertNull(attributeDescriptor.getDefaultValue()); }
|
testAttributeDescriptor2
|
300,168
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ELEMENT toc ANY> <!ATTLIST toc version CDATA #FIXED \"1.0\">"); final XmlTag tag = tag("toc"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("version", tag); assertTrue(!attributeDescriptor.isRequired()); assertTrue(attributeDescriptor.isFixed()); assertTrue(!attributeDescriptor.isEnumerated()); assertEquals("1.0", attributeDescriptor.getDefaultValue()); }
|
testAttributeDescriptor3
|
300,169
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ELEMENT toc ANY> <!ATTLIST toc remote (true|false) \"false\">"); final XmlTag tag = tag("toc"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("remote", tag); assertTrue(!attributeDescriptor.isRequired()); assertTrue(!attributeDescriptor.isFixed()); assertTrue(attributeDescriptor.isEnumerated()); assertEquals("false", attributeDescriptor.getDefaultValue()); String[] values = attributeDescriptor.getEnumeratedValues(); assertEquals(2, values.length); assertEquals("true", values[0]); assertEquals("false", values[1]); }
|
testAttributeDescriptor4
|
300,170
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ELEMENT toc ANY> <!ATTLIST toc remote (0|1|2) #REQUIRED>"); final XmlTag tag = tag("toc"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("remote", tag); assertTrue(attributeDescriptor.isRequired()); assertTrue(!attributeDescriptor.isFixed()); assertTrue(attributeDescriptor.isEnumerated()); assertNull(attributeDescriptor.getDefaultValue()); String[] values = attributeDescriptor.getEnumeratedValues(); assertEquals(3, values.length); assertEquals("0", values[0]); assertEquals("1", values[1]); assertEquals("2", values[2]); }
|
testAttributeDescriptor5
|
300,171
|
void () { final XmlNSDescriptor NSDescriptor = createDescriptor( "<!ENTITY % types \"fileset | patternset \"> <!ELEMENT project (target | taskdef | %types; | property )*> " + "<!ELEMENT target><!ELEMENT taskdef><!ELEMENT fileset><!ELEMENT patternset><!ELEMENT property>"); XmlTag projectTag = tag("project"); final XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(projectTag); final XmlElementDescriptor[] elements = elementDescriptor.getElementsDescriptors(projectTag); assertEquals(5, elements.length); }
|
testEntityDeclElement1
|
300,172
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ENTITY % boolean \"(true|false|on|off|yes|no)\"> <!ELEMENT toc ANY> <!ATTLIST toc remote %boolean; \"false\""); final XmlTag tag = tag("toc"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("remote", tag); assertTrue(!attributeDescriptor.isRequired()); assertTrue(!attributeDescriptor.isFixed()); assertTrue(attributeDescriptor.isEnumerated()); assertEquals("false", (attributeDescriptor.getDefaultValue())); String[] values = attributeDescriptor.getEnumeratedValues(); assertEquals(6, values.length); assertEquals("true", values[0]); assertEquals("false", values[1]); assertEquals("on", values[2]); assertEquals("off", values[3]); assertEquals("yes", values[4]); assertEquals("no", values[5]); }
|
testEntityDecl1
|
300,173
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ENTITY % coreattrs \"id D #IMPLIED\"> <!ELEMENT a ANY> <!ATTLIST a %coreattrs; version CDATA #FIXED \"1.0\""); final XmlTag tag = tag("a"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); final XmlAttributeDescriptor[] attributes = elementDescriptor.getAttributesDescriptors(tag); assertEquals(2, attributes.length); assertEquals("id", attributes[0].getName()); assertEquals("version", attributes[1].getName()); }
|
testEntityDecl2
|
300,174
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ENTITY % att1 \"id1 D #IMPLIED\"> <!ENTITY % att2 \"id2 D #IMPLIED\"> <!ELEMENT a ANY> <!ATTLIST a %att1; %att2; "); final XmlTag tag = tag("a"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); final XmlAttributeDescriptor[] attributes = elementDescriptor.getAttributesDescriptors(tag); assertEquals(2, attributes.length); assertEquals("id1", attributes[0].getName()); assertEquals("id2", attributes[1].getName()); }
|
testEntityDecl3
|
300,175
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ENTITY % boolean '(true|false|on|off|yes|no)'> <!ENTITY % bool \"%boolean;\"> <!ELEMENT toc ANY> <!ATTLIST toc remote %bool; \"false\""); final XmlTag tag = tag("toc"); XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); XmlAttributeDescriptor attributeDescriptor = elementDescriptor.getAttributeDescriptor("remote", tag); assertTrue(!attributeDescriptor.isRequired()); assertTrue(!attributeDescriptor.isFixed()); assertTrue(attributeDescriptor.isEnumerated()); assertEquals("false", attributeDescriptor.getDefaultValue()); String[] values = attributeDescriptor.getEnumeratedValues(); assertEquals(6, values.length); assertEquals("true", values[0]); assertEquals("false", values[1]); assertEquals("on", values[2]); assertEquals("off", values[3]); assertEquals("yes", values[4]); assertEquals("no", values[5]); }
|
testEntityDecl4
|
300,176
|
void () { XmlNSDescriptor NSDescriptor = createDescriptor( "<!ENTITY % boolean \"true | false\" > <!ELEMENT foo EMPTY> <!ATTLIST foo someBoolean (%boolean;) \"true\" someString CDATA #IMPLIED >"); final XmlTag tag = tag("foo"); final XmlElementDescriptor elementDescriptor = NSDescriptor.getElementDescriptor(tag); final XmlAttributeDescriptor[] attributes = elementDescriptor.getAttributesDescriptors(tag); assertEquals(2, attributes.length); assertEquals("someBoolean", attributes[0].getName()); assertEquals("someString", attributes[1].getName()); assertTrue(attributes[0].isEnumerated()); assertEquals(2, attributes[0].getEnumeratedValues().length); assertEquals("true", attributes[0].getEnumeratedValues()[0]); assertEquals("false", attributes[0].getEnumeratedValues()[1]); }
|
testEntityDecl5
|
300,177
|
void () { XmlFile xmlFile = (XmlFile)createFile("test.xml", "<!DOCTYPE tv [ <!ELEMENT tv (date)*> <!ELEMENT date (#PCDATA)> ]> <tv></tv>"); final XmlTag tag = xmlFile.getDocument().getRootTag(); assertNotNull(tag); final XmlElementDescriptor desc = xmlFile.getDocument().getRootTagNSDescriptor().getElementDescriptor(tag); assertNotNull(desc); final XmlElementDescriptor[] elements = desc.getElementsDescriptors(tag); assertEquals(1, elements.length); assertEquals("date", elements[0].getName()); }
|
testEmbeddedDtd1
|
300,178
|
XmlNSDescriptor (String dtdText) { PsiFile dtdFile = createLightFile("test.dtd", dtdText); XmlNSDescriptorImpl descriptor = new XmlNSDescriptorImpl(); descriptor.init(dtdFile); return descriptor; }
|
createDescriptor
|
300,179
|
XmlTag (String tagName) { XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("tag.xml", XmlFileType.INSTANCE, "<" + tagName + "/>"); return file.getDocument().getRootTag(); }
|
tag
|
300,180
|
void () { doOneTest("1.xml", "display-name", "web-app_2_3.dtd"); doOneTest("2.xml", null, "web-app_2_4.xsd"); doOneTest("3.xml", null, "web-app_2_4.xsd", "j2ee_1_4.xsd"); doOneTest("3_2.xml", null, "web-app_2_4.xsd", "j2ee_1_4.xsd"); doOneTest("3_3.xml", null, "web-app_2_4.xsd", "j2ee_1_4.xsd"); doOneTest("4.xml", "context-param", false, false, "web-app_2_4.xsd"); doOneTest("5.xml", "aaa:context-param", false, false, "web-app_2_4.xsd"); doOneTest("6.xsd", "xs:complexType", true, true); doOneTest("7.xml", "bbb"); doOneTest("8.xml", "bbb"); doOneTest("9.xml", "laquo"); }
|
testXmlDoc
|
300,181
|
void () { doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + ".xml", "spring-beans.xsd"); doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + "2.xml", "spring-beans.xsd"); }
|
testXmlDocWithCData
|
300,182
|
void () { doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + ".xml", "web-app_2_4.xsd"); }
|
testXmlDoc2
|
300,183
|
void () { doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + ".xml", "hibernate-mapping-3.0.dtd"); }
|
testXmlDoc3
|
300,184
|
void () { final String testName = getTestName(false); doQuickDocGenerationTestWithCheckExpectedResult(testName + ".xml", testName + ".xsd"); }
|
testXmlDoc4
|
300,185
|
void () { DocumentationTestContext context = new DocumentationTestContext("SchemaPrefix.xml"); assertEquals("XML Namespace Prefix \"xs\" (http://www.w3.org/2001/XMLSchema)", context.getQuickNavigateInfo()); }
|
testSchemaPrefix
|
300,186
|
void () { DocumentationTestContext context = new DocumentationTestContext("9.xml"); assertEquals("\"«\"", context.getQuickNavigateInfo()); }
|
testEntityValue
|
300,187
|
void () { final String testName = getTestName(false); doQuickDocGenerationTestWithCheckExpectedResult((Object)"car", testName + ".xml", testName + ".xsd"); }
|
testXmlDoc6
|
300,188
|
void () { final String testName = getTestName(false); doQuickDocGenerationTestWithCheckExpectedResult((Object)"$Paste", testName + ".xml", testName + ".xsd"); }
|
testXmlDoc7
|
300,189
|
void () { final String testName = getTestName(false); doQuickDocGenerationTestWithCheckExpectedResult((Object)"rect", testName + ".svg"); }
|
testSvgDoc
|
300,190
|
void () { final String testName = getTestName(false); doQuickDocGenerationTestWithCheckExpectedResult((Object)"stroke-width", testName + ".svg"); }
|
testSvgDoc2
|
300,191
|
void () { doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + ".svg"); }
|
testSvgDoc3
|
300,192
|
void () { doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + ".xml", "spring-beans.xsd"); }
|
testScopeAttribute
|
300,193
|
void () { doQuickDocGenerationTestWithNullExpectedResult("class.xml"); }
|
testClassAttribute
|
300,194
|
void () { doQuickDocGenerationTestWithCheckExpectedResult((Object)"apply-imports", "xslCompletion.xsl"); }
|
testXslCompletion
|
300,195
|
void () { doQuickDocGenerationTestWithNullExpectedResult("component.xml"); }
|
testNoHtmlDocInXml
|
300,196
|
void (final String... baseFileNames) { doQuickDocGenerationTestWithCheckExpectedResult(null, baseFileNames); }
|
doQuickDocGenerationTestWithCheckExpectedResult
|
300,197
|
void (final String... baseFileNames) { final DocumentationTestContext context = new DocumentationTestContext(baseFileNames); String text = context.generateDoc(); assertThat(text).isNull(); }
|
doQuickDocGenerationTestWithNullExpectedResult
|
300,198
|
void (Object completionVariant, final String... baseFileNames) { final DocumentationTestContext context = new DocumentationTestContext(baseFileNames); String pathname = getTestDataPath() + baseFileNames[0] + ".expected.html"; VirtualFile vfile = LocalFileSystem.getInstance().findFileByIoFile(new File(pathname)); assertNotNull(pathname + " not found", vfile); try { String expectedText = StringUtil.convertLineSeparators(VfsUtilCore.loadText(vfile)); String text = context.generateDoc(); assertThat(text).isNotNull(); assertEquals(stripFirstLine(expectedText).replaceAll("\\s+", ""), stripFirstLine(StringUtil.convertLineSeparators(text)).replaceAll("\\s+", "")); if (completionVariant != null) { vfile = LocalFileSystem.getInstance().findFileByIoFile(new File(getTestDataPath() + baseFileNames[0] + ".expected.completion.html")); expectedText = StringUtil.convertLineSeparators(VfsUtilCore.loadText(vfile), "\n"); assertEquals(stripFirstLine(expectedText).replaceAll("\\s+", ""), stripFirstLine(StringUtil.convertLineSeparators(context.generateDocForCompletion(completionVariant), "\n")) .replaceAll("\\s+", "")); } } catch (IOException e) { throw new RuntimeException(e); } }
|
doQuickDocGenerationTestWithCheckExpectedResult
|
300,199
|
String (String text) { if (!text.startsWith("<html ")) return text; return text.substring(text.indexOf('\n')); }
|
stripFirstLine
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.