2
using MonoDevelop.Ide.CodeCompletion;
3
using MonoDevelop.XmlEditor;
8
namespace MonoDevelop.XmlEditor.Tests.Schema
11
/// Tests attribute refs
14
public class AttributeRefTestFixture : SchemaTestFixtureBase
16
ICompletionData[] attributes;
18
public override void FixtureInit()
20
XmlElementPath path = new XmlElementPath();
21
path.Elements.Add(new QualifiedName("html", "http://foo/xhtml"));
22
attributes = SchemaCompletionData.GetAttributeCompletionData(path);
26
public void HtmlAttributeCount()
28
Assert.AreEqual(4, attributes.Length,
29
"Should be 4 attributes.");
33
public void HtmlLangAttribute()
35
Assert.IsTrue(SchemaTestFixtureBase.Contains(attributes, "lang"), "Attribute lang not found.");
39
public void HtmlIdAttribute()
41
Assert.IsTrue(SchemaTestFixtureBase.Contains(attributes, "id"), "Attribute id not found.");
45
public void HtmlDirAttribute()
47
Assert.IsTrue(SchemaTestFixtureBase.Contains(attributes, "dir"), "Attribute dir not found.");
51
public void HtmlXmlLangAttribute()
53
Assert.IsTrue(SchemaTestFixtureBase.Contains(attributes, "xml:lang"), "Attribute xml:lang not found.");
56
protected override string GetSchema()
58
return "<xs:schema version=\"1.0\" xml:lang=\"en\"\r\n" +
59
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
60
" targetNamespace=\"http://foo/xhtml\"\r\n" +
61
" xmlns=\"http://foo/xhtml\"\r\n" +
62
" elementFormDefault=\"qualified\">\r\n" +
63
" <xs:element name=\"html\">\r\n" +
64
" <xs:complexType>\r\n" +
65
" <xs:sequence>\r\n" +
66
" <xs:element ref=\"head\"/>\r\n" +
67
" <xs:element ref=\"body\"/>\r\n" +
68
" </xs:sequence>\r\n" +
69
" <xs:attributeGroup ref=\"i18n\"/>\r\n" +
70
" <xs:attribute name=\"id\" type=\"xs:ID\"/>\r\n" +
71
" </xs:complexType>\r\n" +
72
" </xs:element>\r\n" +
74
" <xs:element name=\"head\" type=\"xs:string\"/>\r\n" +
75
" <xs:element name=\"body\" type=\"xs:string\"/>\r\n" +
77
" <xs:attributeGroup name=\"i18n\">\r\n" +
78
" <xs:annotation>\r\n" +
79
" <xs:documentation>\r\n" +
80
" internationalization attributes\r\n" +
81
" lang language code (backwards compatible)\r\n" +
82
" xml:lang language code (as per XML 1.0 spec)\r\n" +
83
" dir direction for weak/neutral text\r\n" +
84
" </xs:documentation>\r\n" +
85
" </xs:annotation>\r\n" +
86
" <xs:attribute name=\"lang\" type=\"LanguageCode\"/>\r\n" +
87
" <xs:attribute ref=\"xml:lang\"/>\r\n" +
89
" <xs:attribute name=\"dir\">\r\n" +
90
" <xs:simpleType>\r\n" +
91
" <xs:restriction base=\"xs:token\">\r\n" +
92
" <xs:enumeration value=\"ltr\"/>\r\n" +
93
" <xs:enumeration value=\"rtl\"/>\r\n" +
94
" </xs:restriction>\r\n" +
95
" </xs:simpleType>\r\n" +
96
" </xs:attribute>\r\n" +
97
" </xs:attributeGroup>\r\n" +