public void DontResolveForAbsoluteUrls()
		{
			var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
			var css = @".icon1 { background-image: url(""http://www.castleproject.org/images/icons/file-xslx.gif"") !important; }, .icon2 { background-image: url('http://www.castleproject.org//images/icons/test2.png') }, .icon3 { background-image: url(http://www.castleproject.org//images/icons/test3.png) }";
			var output = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", css);
			Assert.AreEqual(css, output);
		}
Esempio n. 2
0
        public void ResolveForRelativeUrlsWithDoubleQuotes()
        {
            var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
            var output   = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", @".icon1 { background-image: url(""../images/icons/file-xslx.gif"") !important; }, .icon2 { background-image: url(""../images/icons/test2.png"") }");

            Assert.AreEqual(@".icon1 { background-image: url(""/myapp/images/icons/file-xslx.gif"") !important; }, .icon2 { background-image: url(""/myapp/images/icons/test2.png"") }", output);
        }
		public void DontResolveForNonRelativeUrlsWithDoubleQuotes()
		{
			var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
			var css = @".icon1 { background-image: url(""/images/icons/file-xslx.gif"") !important; }, .icon2 { background-image: url(""/images/icons/test2.png"") }";
			var output = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", css);
			Assert.AreEqual(css, output);
		}
Esempio n. 4
0
        public void ResolveForMultipleUrlsRelative()
        {
            var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
            var output   = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", @".icon1 { background-image: url(../images/test1.png) }, .icon2 { background-image: url(../images/icons/test2.png) }");

            Assert.AreEqual(".icon1 { background-image: url(/myapp/images/test1.png) }, .icon2 { background-image: url(/myapp/images/icons/test2.png) }", output);
        }
Esempio n. 5
0
        public void DontResolveForNonRelative()
        {
            var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
            var output   = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", ".icon { background-image: url(/myapp/test.png) }");

            Assert.AreEqual(".icon { background-image: url(/myapp/test.png) }", output);
        }
Esempio n. 6
0
        public void DontResolveForAbsoluteHttpsUrls()
        {
            var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
            var css      = @".icon1 { background-image: url(""https://www.castleproject.org/images/icons/file-xslx.gif"") !important; }, .icon2 { background-image: url('https://www.castleproject.org//images/icons/test2.png') }, .icon3 { background-image: url(https://www.castleproject.org//images/icons/test3.png) }";
            var output   = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", css);

            Assert.AreEqual(css, output);
        }
Esempio n. 7
0
        public void DontResolveForNonRelativeUrlsWithSingleQuotes()
        {
            var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
            var css      = @".icon1 { background-image: url('/images/icons/file-xslx.gif') !important; }, .icon2 { background-image: url('/images/icons/test2.png') }";
            var output   = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", css);

            Assert.AreEqual(css, output);
        }
Esempio n. 8
0
        public void DontResolveForAbsoluteUrlsWithDataProtocol()
        {
            var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
            var css      = @".icon1 { background-image: url(""data:image/gif;base64,AAAA"") !important; }, .icon2 { background-image: url('data:image/gif;base64,AAAA') }, .icon3 { background-image: url(data:image/gif;base64,AAAA) }";
            var output   = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", css);

            Assert.AreEqual(css, output);
        }
		public void ResolveForRelativeUrlsWithSingleQuotes()
		{
			var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
			var output = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", @".icon1 { background-image: url('../images/icons/file-xslx.gif') !important; }, .icon2 { background-image: url('../images/icons/test2.png') }");
			Assert.AreEqual(@".icon1 { background-image: url('/myapp/images/icons/file-xslx.gif') !important; }, .icon2 { background-image: url('/myapp/images/icons/test2.png') }", output);
		}
		public void ResolveForMultipleUrlsRelative()
		{
			var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
			var output = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", @".icon1 { background-image: url(../images/test1.png) }, .icon2 { background-image: url(../images/icons/test2.png) }");
			Assert.AreEqual(".icon1 { background-image: url(/myapp/images/test1.png) }, .icon2 { background-image: url(/myapp/images/icons/test2.png) }", output);
		}
		public void DontResolveForNonRelative()
		{
			var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
			var output = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", ".icon { background-image: url(/myapp/test.png) }");
			Assert.AreEqual(".icon { background-image: url(/myapp/test.png) }", output);
		}
		public void DontResolveForAbsoluteUrlsWithDataProtocol()
		{
			var resolver = new CombineJSViewComponent.CssRelativeUrlResolver(@"c:\inetpub\wwwroot\myapp\", new Uri("/myapp/", UriKind.Relative));
			var css = @".icon1 { background-image: url(""data:image/gif;base64,AAAA"") !important; }, .icon2 { background-image: url('data:image/gif;base64,AAAA') }, .icon3 { background-image: url(data:image/gif;base64,AAAA) }";
			var output = resolver.Resolve(@"c:\inetpub\wwwroot\myapp\css\main.css", css);
			Assert.AreEqual(css, output);
		}