Beispiel #1
0
 public void DOMTokenListWritesBack()
 {
     var document = new HtmlDocument();
     var testClass = "myclass";
     var div = new HtmlDivElement(document);
     div.ClassName = "";
     div.ClassList.Add(testClass);
     Assert.AreEqual(testClass, div.ClassName);
 }
Beispiel #2
0
 public void DOMStringMapHasAttributesButRequestedMissing()
 {
     var document = new HtmlDocument();
     var div = new HtmlDivElement(document);
     div.SetAttribute("data-some", "test");
     div.SetAttribute("data-another", "");
     div.SetAttribute("data-test", "third attribute");
     Assert.IsTrue(div.Dataset["user"] == null);
 }
Beispiel #3
0
 public void DOMStringMapIEnumerableWorking()
 {
     var document = new HtmlDocument();
     var div = new HtmlDivElement(document);
     div.SetAttribute("data-some", "test");
     div.SetAttribute("data-another", "");
     div.SetAttribute("data-test", "third attribute");
     Assert.AreEqual(3, div.Dataset.Count());
     Assert.AreEqual("some", div.Dataset.First().Key);
     Assert.AreEqual("test", div.Dataset.First().Value);
     Assert.AreEqual("test", div.Dataset.Last().Key);
     Assert.AreEqual("third attribute", div.Dataset.Last().Value);
 }
Beispiel #4
0
 public void DOMStringMapHasNoAttribute()
 {
     var document = new HtmlDocument();
     var div = new HtmlDivElement(document);
     Assert.IsTrue(div.Dataset["user"] == null);
 }
Beispiel #5
0
 public void DOMStringMapBindingSet()
 {
     var document = new HtmlDocument();
     var value = "SomeUser";
     var div = new HtmlDivElement(document);
     div.Dataset["user"] = value;
     Assert.AreEqual(div.GetAttribute("data-user"), value);
 }
Beispiel #6
0
 public void DOMTokenListToggleWorksTurnOn()
 {
     var document = new HtmlDocument();
     var testClass = "myclass";
     var otherClasses = "otherClass someOther more";
     var div = new HtmlDivElement(document);
     div.ClassName = otherClasses;
     div.ClassList.Toggle(testClass);
     Assert.AreEqual(div.ClassName, otherClasses + " " + testClass);
 }
Beispiel #7
0
 public void DOMTokenListCorrectlyInitializedNoClass()
 {
     var document = new HtmlDocument();
     var testClass = "myclass1";
     var div = new HtmlDivElement(document);
     div.ClassName = "myclass2 whatever anotherclass";
     Assert.IsFalse(div.ClassList.Contains(testClass));
 }
Beispiel #8
0
 public void DOMTokenListCorrectlyInitializedFindsClass()
 {
     var document = new HtmlDocument();
     var testClass = "myclass";
     var div = new HtmlDivElement(document) { ClassName = testClass + " whatever anotherclass" };
     Assert.IsTrue(div.ClassList.Contains(testClass));
 }