mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
WEB-6803 HTML microdata: properties of item are taken from the wrong scope in case of nested scopes
This commit is contained in:
@@ -94,9 +94,10 @@ public class MicrodataAttributeDescriptorsProvider implements XmlAttributeDescri
|
||||
|
||||
private static class MicrodataPropertyAttributeDescriptor extends AnyXmlAttributeDescriptor {
|
||||
|
||||
@NotNull
|
||||
private final XmlTag myContext;
|
||||
|
||||
public MicrodataPropertyAttributeDescriptor(XmlTag context) {
|
||||
public MicrodataPropertyAttributeDescriptor(@NotNull XmlTag context) {
|
||||
super(ITEM_PROP);
|
||||
myContext = context;
|
||||
}
|
||||
@@ -114,7 +115,7 @@ public class MicrodataAttributeDescriptorsProvider implements XmlAttributeDescri
|
||||
|
||||
@Override
|
||||
public String[] getEnumeratedValues() {
|
||||
final XmlTag scopeParent = findScopeTag(myContext);
|
||||
final XmlTag scopeParent = findScopeTag(myContext.getParentTag());
|
||||
return scopeParent != null ? findProperties(scopeParent) : super.getEnumeratedValues();
|
||||
}
|
||||
|
||||
|
||||
@@ -151,4 +151,25 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase {
|
||||
"name", "nickname", "photo", "title", "role", "url", "affiliation", "friend", "acquaintance", "address"
|
||||
);
|
||||
}
|
||||
|
||||
public void testPropValueNestedScopes() throws Throwable {
|
||||
final VirtualFile personFile = myFixture.copyFileToProject("Person.html");
|
||||
final VirtualFile addressFile = myFixture.copyFileToProject("Address.html");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Person", personFile.getPath());
|
||||
ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Address", addressFile.getPath());
|
||||
}
|
||||
});
|
||||
doTestInHtml("<div itemscope itemtype=\"http://data-vocabulary.org/Person\">\n" +
|
||||
" My name is <span itemprop=\"name\">Smith</span>\n" +
|
||||
" <span itemprop=\"<caret>\" itemscope itemtype=\"http://data-vocabulary.org/Address\">\n" +
|
||||
" <span itemprop=\"locality\">Albuquerque</span>\n" +
|
||||
" <span itemprop=\"region\">NM</span>\n" +
|
||||
" </span>\n" +
|
||||
"</div>",
|
||||
"name", "nickname", "photo", "title", "role", "url", "affiliation", "friend", "acquaintance", "address"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user