Exemplo n.º 1
0
    public void TestStyleEmptyStyleAttr()
    {
        CssXmlElement       elm = getElm("<a style='' />", "", "a") as CssXmlElement;
        CssStyleDeclaration csd = (CssStyleDeclaration)elm.Style;

        Assert.AreEqual("", csd.CssText);
        Assert.AreEqual(0, csd.Length);
        Assert.AreEqual(CssStyleSheetType.Inline, csd.Origin);
    }
Exemplo n.º 2
0
    public void TestStyleCreate()
    {
        CssXmlElement elm = getElm("<a />", "", "a") as CssXmlElement;

        Assert.AreEqual("", elm.Style.CssText);

        elm.SetAttribute("style", "run:ar");
        Assert.AreEqual("run:ar;", elm.Style.CssText);
    }
Exemplo n.º 3
0
    public void TestStyleRemove()
    {
        CssXmlElement elm = getElm("<a style='foo:bar' />", "", "a") as CssXmlElement;

        Assert.AreEqual("foo:bar;", elm.Style.CssText);

        elm.RemoveAttribute("style");
        Assert.AreEqual("", elm.Style.CssText);
    }
Exemplo n.º 4
0
    public void TestStyleSingle()
    {
        CssXmlElement       elm = getElm("<a style='foo:bar' />", "", "a") as CssXmlElement;
        CssStyleDeclaration csd = (CssStyleDeclaration)elm.Style;

        Assert.AreEqual("foo:bar;", csd.CssText);
        Assert.AreEqual(1, csd.Length);
        Assert.AreEqual("foo", csd[0]);
        Assert.AreEqual("bar", csd.GetPropertyValue("foo"));
        Assert.AreEqual(CssStyleSheetType.Inline, csd.Origin);
    }
Exemplo n.º 5
0
    public void TestStyleMultipleWithSame()
    {
        CssXmlElement        elm = getElm("<a style='foo:bar; kalle:roffe;foo:newvalue' />", "", "a") as CssXmlElement;
        ICssStyleDeclaration csd = elm.Style;

        if (!csd.CssText.Equals("kalle:roffe;foo:newvalue;") &&
            !csd.CssText.Equals("foo:newvalue;kalle:roffe;"))
        {
            Assert.Fail();
        }
        Assert.AreEqual(2, csd.Length);
        Assert.AreEqual("newvalue", csd.GetPropertyValue("foo"));
    }
Exemplo n.º 6
0
    public void TestStyleMultiple()
    {
        CssXmlElement       elm = getElm("<a style='foo:bar; kalle:roffe' />", "", "a") as CssXmlElement;
        CssStyleDeclaration csd = (CssStyleDeclaration)elm.Style;

        if (!csd.CssText.Equals("foo:bar;kalle:roffe;") &&
            !csd.CssText.Equals("kalle:roffe;foo:bar;"))
        {
            Assert.Fail();
        }
        Assert.AreEqual(2, csd.Length);
        Assert.AreEqual("bar", csd.GetPropertyValue("foo"));
        Assert.AreEqual("roffe", csd.GetPropertyValue("kalle"));
        Assert.AreEqual(CssStyleSheetType.Inline, csd.Origin);
    }