<commit_before>﻿namespace AngleSharp.Core.Tests.Css
{
    using AngleSharp.Dom.Css;
    using NUnit.Framework;

    [TestFixture]
    public class CssCoordinatePropertyTests : CssConstructionFunctions
    {
        [Test]
        public void CssHeightLegalPercentage()
        {
            var snippet = "height:   28% ";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("height", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssHeightProperty>(property);
            var concrete = (CssHeightProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("28%", concrete.Value);
            //Assert.IsInstanceOf<Percent>(value);
        }

        [Test]
        public void CssHeightLegalLengthInEm()
        {
            var snippet = "height:   0.3em ";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("height", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssHeightProperty>(property);
            var concrete = (CssHeightProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("0.3em", concrete.Value);
            //Assert.IsInstanceOf<Length>(value);
        }

        [Test]
        public void CssHeightLegalLengthInPx()
        {
            var snippet = "height:   144px ";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("height", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssHeightProperty>(property);
            var concrete = (CssHeightProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("144px", concrete.Value);
            //Assert.IsInstanceOf<Length>(value);
        }

        [Test]
        public void CssHeightLegalAutoUppercase()
        {
            var snippet = "height: AUTO ";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("height", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssHeightProperty>(property);
            var concrete = (CssHeightProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("auto", concrete.Value);
        }

        [Test]
        public void CssWidthLegalLengthInCm()
        {
            var snippet = "width:0.5cm";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("width", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssWidthProperty>(property);
            var concrete = (CssWidthProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("0.5cm", concrete.Value);
            //Assert.IsInstanceOf<Length>(value);
        }

        [Test]
        public void CssWidthLegalLengthInMm()
        {
            var snippet = "width:1.5mm";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("width", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssWidthProperty>(property);
            var concrete = (CssWidthProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("1.5mm", concrete.Value);
            //Assert.IsInstanceOf<Length>(value);
        }

        [Test]
        public void CssWidthIllegalLength()
        {
            var snippet = "width:1.5 meter";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("width", property.Name);
            Assert.IsFalse(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssWidthProperty>(property);
            var concrete = (CssWidthProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.IsNotNull(concrete);
        }

        [Test]
        public void CssLeftLegalPixel()
        {
            var snippet = "left: 25px";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("left", property.Name);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssLeftProperty>(property);
            var concrete = (CssLeftProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.IsTrue(concrete.HasValue);
        }

        [Test]
        public void CssTopLegalEm()
        {
            var snippet = "top:  0.7em ";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("top", property.Name);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssTopProperty>(property);
            var concrete = (CssTopProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.IsTrue(concrete.HasValue);
        }

        [Test]
        public void CssRightLegalMm()
        {
            var snippet = "right:  1.5mm";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("right", property.Name);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssRightProperty>(property);
            var concrete = (CssRightProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.IsTrue(concrete.HasValue);
        }

        [Test]
        public void CssBottomLegalPercent()<commit_msg>Added test for the property<commit_after>﻿namespace AngleSharp.Core.Tests.Css
{
    using AngleSharp.Dom.Css;
    using NUnit.Framework;
    using System.Linq;

    [TestFixture]
    public class CssCoordinatePropertyTests : CssConstructionFunctions
    {
        [Test]
        public void CssHeightLegalPercentage()
        {
            var snippet = "height:   28% ";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("height", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssHeightProperty>(property);
            var concrete = (CssHeightProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("28%", concrete.Value);
            //Assert.IsInstanceOf<Percent>(value);
        }

        [Test]
        public void CssHeightLegalLengthInEm()
        {
            var snippet = "height:   0.3em ";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("height", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssHeightProperty>(property);
            var concrete = (CssHeightProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("0.3em", concrete.Value);
            //Assert.IsInstanceOf<Length>(value);
        }

        [Test]
        public void CssHeightLegalLengthInPx()
        {
            var snippet = "height:   144px ";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("height", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssHeightProperty>(property);
            var concrete = (CssHeightProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("144px", concrete.Value);
            //Assert.IsInstanceOf<Length>(value);
        }

        [Test]
        public void CssHeightLegalAutoUppercase()
        {
            var snippet = "height: AUTO ";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("height", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssHeightProperty>(property);
            var concrete = (CssHeightProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("auto", concrete.Value);
        }

        [Test]
        public void CssWidthLegalLengthInCm()
        {
            var snippet = "width:0.5cm";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("width", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssWidthProperty>(property);
            var concrete = (CssWidthProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("0.5cm", concrete.Value);
            //Assert.IsInstanceOf<Length>(value);
        }

        [Test]
        public void CssWidthLegalLengthInMm()
        {
            var snippet = "width:1.5mm";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("width", property.Name);
            Assert.IsTrue(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssWidthProperty>(property);
            var concrete = (CssWidthProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.AreEqual("1.5mm", concrete.Value);
            //Assert.IsInstanceOf<Length>(value);
        }

        [Test]
        public void CssWidthIllegalLength()
        {
            var snippet = "width:1.5 meter";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("width", property.Name);
            Assert.IsFalse(property.HasValue);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssWidthProperty>(property);
            var concrete = (CssWidthProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.IsNotNull(concrete);
        }

        [Test]
        public void CssLeftLegalPixel()
        {
            var snippet = "left: 25px";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("left", property.Name);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssLeftProperty>(property);
            var concrete = (CssLeftProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.IsTrue(concrete.HasValue);
        }

        [Test]
        public void CssTopLegalEm()
        {
            var snippet = "top:  0.7em ";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("top", property.Name);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssTopProperty>(property);
            var concrete = (CssTopProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.IsTrue(concrete.HasValue);
        }

        [Test]
        public void CssRightLegalMm()
        {
            var snippet = "right:  1.5mm";
            var property = ParseDeclaration(snippet);
            Assert.AreEqual("right", property.Name);
            Assert.IsFalse(property.IsImportant);
            Assert.IsInstanceOf<CssRightProperty>(property);
            var concrete = (CssRightProperty)property;
            Assert.IsFalse(concrete.IsInherited);
            Assert.IsTrue(concrete.HasValue);
        }

        [Test]
        public void CssBottomFoundInStyleDeclaration()
        {
            var snippet = "bottom:  50%";
            var style = ParseDeclarations(snippet);
            Assert.AreEqual(1, style.Length);
            var bottom = style.Declarations.First();
            Assert.AreEqual("bottom", bottom.Name);
            Assert.AreEqual("50%", ((ICssStyleDeclaration)style).Bottom);
        }

        [Test]
        public void CssBottomLegalPercent()
{'fraction_non_alphanumeric': 0.10424774364494493, 'fraction_numerical': 0.005382131324004306, 'mean_word_length': 2.0569476082004554, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3742892', 'n_tokens_mistral': 3251, 'n_tokens_neox': 3161, 'n_words': 487}