示例#1
0
        public static async Task Initialize(TestContext context)
        {
            Initialize();
            _stylessheet = await Stylesheet.GetInstance();

            _stylessheet.Reset();
        }
        public static async Task InitClass(TestContext context)
        {
            Initialize();
            _stylesheet = await Stylesheet.GetInstance();

            _stylesheet.SetConfig(new StyleSheetConfig {
                InjectionMode = InjectionMode.None
            });
        }
        /// <summary>
        /// Sets the current RTL value.
        /// </summary>
        /// <param name="isRTL"></param>
        /// <returns></returns>
        public static async Task SetRTL(bool isRTL)
        {
            if (_isRTL != isRTL)
            {
                var instance = await Stylesheet.GetInstance();

                instance?.Reset();
                _isRTL = isRTL;
            }
        }
示例#4
0
        /// <summary>
        /// Sets the current RTL value.
        /// </summary>
        /// <param name="isRTL"></param>
        /// <returns></returns>
        public static void SetRTL(bool isRTL)
        {
            if (_isRTL != isRTL)
            {
                var instance = Stylesheet.GetInstance();

                instance?.Reset();
                _isRTL = isRTL;
            }
        }
        public async Task CanNamespaceThings()
        {
            (var html, var css) = StyleEngine.RenderStatic(() =>
            {
                var classNames = StyleEngine.MergeStyleSets(new StyleSetFake
                {
                    Root = new Style
                    {
                        Background = "red"
                    }
                });

                return($"<div class=\"{classNames.Root}\">Hello!</div>");
            }, "test");
            var sheet = await Stylesheet.GetInstance();

            sheet.SetConfig(new StyleSheetConfig {
                InjectionMode = InjectionMode.None, Namespace = null, DefaultPrefix = "css"
            });
            Assert.AreEqual("<div class=\"test-root-0\">Hello!</div>", html);
            Assert.AreEqual(".test-root-0{background:red;}", css);
        }
示例#6
0
 public static async Task ClassInit(TestContext context)
 {
     stylesheet = await Stylesheet.GetInstance();
 }