示例#1
0
        public void JSTest()
        {
            var target = new Media_Accessor();

            target._jsDirty  = true;
            target._jsOutput = null;
            target.AddJS("http://example.com/test.js");
            Assert.AreEqual("<script src=\"http://example.com/test.js\" type=\"text/javascript\"></script>",
                            target.JS);

            target._jsDirty  = true;
            target._jsOutput = "Test";
            Assert.AreEqual("<script src=\"http://example.com/test.js\" type=\"text/javascript\"></script>",
                            target.JS);

            target._jsDirty  = false;
            target._jsOutput = "Test";
            Assert.AreEqual("Test",
                            target.JS);

            target.AddJS("http://example.com/test2.js");
            target._jsDirty  = false;
            target._jsOutput = null;
            Assert.AreEqual("<script src=\"http://example.com/test.js\" type=\"text/javascript\"></script>\n" +
                            "<script src=\"http://example.com/test2.js\" type=\"text/javascript\"></script>",
                            target.JS);
        }
示例#2
0
        public void AppendTest()
        {
            Media_Accessor target = new Media_Accessor();

            target.AddJS("http://example.com/myfile.js");
            target.AddJS("local.js");

            Media source = new Media();

            source.AddJS("local.js");
            source.AddJS("local2.js");
            source.AddCss("http://example.com/myfile.css");

            target.Append(source);

            Assert.AreEqual(3, target._js.Count);
            Assert.AreEqual(1, target._css.Count);
        }
示例#3
0
        public void AddJSTest()
        {
            Media_Accessor target = new Media_Accessor();

            target._jsDirty = false;
            target.AddJS("http://example.com/myfile.js");
            Assert.AreEqual(1, target._js.Count);
            Assert.IsTrue(target._jsDirty);

            target._jsDirty = false;
            target.AddJS("http://example.com/myfile.js");
            Assert.AreEqual(1, target._js.Count);
            Assert.IsFalse(target._jsDirty);

            target._jsDirty = false;
            target.AddJS("local.js");
            Assert.AreEqual(2, target._js.Count);
            Assert.IsTrue(target._jsDirty);
        }