<commit_before>describe('CSS Parsers', function (){

	it('should parse lengths', function(){
		var testee = document.getElementById('testee')

		expect(moofx.parse('width', "")).to.be("")
		expect(moofx.parse('width')).to.be("")
		expect(moofx.parse('width', null)).to.be("")
		expect(moofx.parse('width', "auto")).to.be("auto")
		expect(moofx.parse('width', "10")).to.be("10px")
		expect(moofx.parse('width', 10)).to.be("10px")
		expect(moofx.parse('width', 0)).to.be("0px")
		expect(moofx.parse('width', "0%")).to.be("0%")
		expect(moofx.parse('width', "10%")).to.be("10%")

		// normalized
		expect(moofx.parse('width', "", true)).to.be("0px")
		expect(moofx.parse('width', undefined, true)).to.be("0px")
		expect(moofx.parse('width', null, true)).to.be("0px")

		// normalized to pixel
		expect(moofx.parse('width', "10%", true, testee)).to.be("10px")
	})

	it('should parse 4 values shorthands', function(){
		var testee = document.getElementById('testee')

		expect(moofx.parse('margin', "")).to.be("")
		expect(moofx.parse('margin', undefined)).to.be("")
		expect(moofx.parse('margin', null)).to.be("")
		expect(moofx.parse('margin', "auto")).to.be("auto auto auto auto")
		expect(moofx.parse('margin', "10")).to.be("10px 10px 10px 10px")
		expect(moofx.parse('margin', 10)).to.be("10px 10px 10px 10px")
		expect(moofx.parse('margin', 0)).to.be("0px 0px 0px 0px")
		expect(moofx.parse('margin', "0%")).to.be("0% 0% 0% 0%")
		expect(moofx.parse('margin', "10%")).to.be("10% 10% 10% 10%")
		expect(moofx.parse('margin', "10% 20px")).to.be("10% 20px 10% 20px")
		expect(moofx.parse('margin', "10% 20px 30em")).to.be("10% 20px 30em 20px")
		expect(moofx.parse('margin', "10% 20px 30em 40mm")).to.be("10% 20px 30em 40mm")

		//normalized
		expect(moofx.parse('margin', "", true)).to.be("0px 0px 0px 0px")
		expect(moofx.parse('margin', undefined, true)).to.be("0px 0px 0px 0px")
		expect(moofx.parse('margin', null, true)).to.be("0px 0px 0px 0px")

		expect(moofx.parse('margin', "10% auto 30em", true)).to.be("10% auto 30em auto")

		// normalized to pixel
		expect(moofx.parse('margin', "10%", true, testee)).to.be("10px 10px 10px 10px")
		expect(moofx.parse('margin', "10% 20% 30%", true, testee)).to.be("10px 20px 30px 20px")

	})

	it('should parse numbers', function(){
		expect(moofx.parse('opacity', "")).to.be("")
		expect(moofx.parse('opacity', undefined)).to.be("")
		expect(moofx.parse('opacity', null)).to.be("")
		expect(moofx.parse('opacity', "arbitrary")).to.be("1")
		expect(moofx.parse('opacity', "10")).to.be("10")
		expect(moofx.parse('opacity', "10px")).to.be("10")
		expect(moofx.parse('opacity', 0)).to.be("0")
		expect(moofx.parse('opacity', "0%")).to.be("0")
		expect(moofx.parse('opacity', "10%")).to.be("10")
	})

	it('should parse colors', function(){
		expect(moofx.parse('color', "")).to.be("")
		expect(moofx.parse('color', undefined)).to.be("")
		expect(moofx.parse('color', null)).to.be("")
		expect(moofx.parse('color', "arbitrary")).to.be("")
		expect(moofx.parse('color', "10")).to.be("")
		expect(moofx.parse('color', "10px")).to.be("")
		expect(moofx.parse('color', 0)).to.be("")
		expect(moofx.parse('color', "0%")).to.be("")
		expect(moofx.parse('color', "10%")).to.be("")

		expect(moofx.parse('color', "#000")).to.be("rgb(0,0,0)")
		expect(moofx.parse('color', "#0000")).to.be("rgba(0,0,0,0)")
		expect(moofx.parse('color', "#000f")).to.be("rgb(0,0,0)")
		expect(moofx.parse('color', "rgb(0, 0, 0, 0.5)")).to.be("rgba(0,0,0,0.5)")
		expect(moofx.parse('color', "rgba(0, 0, 0, 1)")).to.be("rgb(0,0,0)")
		expect(moofx.parse('color', "rgb(0,0,0)")).to.be("rgb(0,0,0)")
		expect(moofx.parse('color', "#ff330099")).to.be("rgba(255,51,0,0.6)")
		expect(moofx.parse('color', "#f309")).to.be("rgba(255,51,0,0.6)")

		// normalized
		expect(moofx.parse('color', "", true)).to.be("rgba(0,0,0,1)")
		expect(moofx.parse('color', undefined, true)).to.be("rgba(0,0,0,1)")<commit_msg>invalid opacity should always be 1<commit_after>describe('CSS Parsers', function (){

	it('should parse lengths', function(){
		var testee = document.getElementById('testee')

		expect(moofx.parse('width', "")).to.be("")
		expect(moofx.parse('width')).to.be("")
		expect(moofx.parse('width', null)).to.be("")
		expect(moofx.parse('width', "auto")).to.be("auto")
		expect(moofx.parse('width', "10")).to.be("10px")
		expect(moofx.parse('width', 10)).to.be("10px")
		expect(moofx.parse('width', 0)).to.be("0px")
		expect(moofx.parse('width', "0%")).to.be("0%")
		expect(moofx.parse('width', "10%")).to.be("10%")

		// normalized
		expect(moofx.parse('width', "", true)).to.be("0px")
		expect(moofx.parse('width', undefined, true)).to.be("0px")
		expect(moofx.parse('width', null, true)).to.be("0px")

		// normalized to pixel
		expect(moofx.parse('width', "10%", true, testee)).to.be("10px")
	})

	it('should parse 4 values shorthands', function(){
		var testee = document.getElementById('testee')

		expect(moofx.parse('margin', "")).to.be("")
		expect(moofx.parse('margin', undefined)).to.be("")
		expect(moofx.parse('margin', null)).to.be("")
		expect(moofx.parse('margin', "auto")).to.be("auto auto auto auto")
		expect(moofx.parse('margin', "10")).to.be("10px 10px 10px 10px")
		expect(moofx.parse('margin', 10)).to.be("10px 10px 10px 10px")
		expect(moofx.parse('margin', 0)).to.be("0px 0px 0px 0px")
		expect(moofx.parse('margin', "0%")).to.be("0% 0% 0% 0%")
		expect(moofx.parse('margin', "10%")).to.be("10% 10% 10% 10%")
		expect(moofx.parse('margin', "10% 20px")).to.be("10% 20px 10% 20px")
		expect(moofx.parse('margin', "10% 20px 30em")).to.be("10% 20px 30em 20px")
		expect(moofx.parse('margin', "10% 20px 30em 40mm")).to.be("10% 20px 30em 40mm")

		//normalized
		expect(moofx.parse('margin', "", true)).to.be("0px 0px 0px 0px")
		expect(moofx.parse('margin', undefined, true)).to.be("0px 0px 0px 0px")
		expect(moofx.parse('margin', null, true)).to.be("0px 0px 0px 0px")

		expect(moofx.parse('margin', "10% auto 30em", true)).to.be("10% auto 30em auto")

		// normalized to pixel
		expect(moofx.parse('margin', "10%", true, testee)).to.be("10px 10px 10px 10px")
		expect(moofx.parse('margin', "10% 20% 30%", true, testee)).to.be("10px 20px 30px 20px")

	})

	it('should parse numbers', function(){
		expect(moofx.parse('opacity', "")).to.be("")
		expect(moofx.parse('opacity', undefined)).to.be("")
		expect(moofx.parse('opacity', null)).to.be("")
		expect(moofx.parse('opacity', "arbitrary")).to.be("1")
        expect(moofx.parse('opacity', "10")).to.be("10")
        expect(moofx.parse('opacity', "10px")).to.be("1")
        expect(moofx.parse('opacity', 0)).to.be("0")
        expect(moofx.parse('opacity', "0%")).to.be("1")
        expect(moofx.parse('opacity', "10%")).to.be("1")
	})

	it('should parse colors', function(){
		expect(moofx.parse('color', "")).to.be("")
		expect(moofx.parse('color', undefined)).to.be("")
		expect(moofx.parse('color', null)).to.be("")
		expect(moofx.parse('color', "arbitrary")).to.be("")
		expect(moofx.parse('color', "10")).to.be("")
		expect(moofx.parse('color', "10px")).to.be("")
		expect(moofx.parse('color', 0)).to.be("")
		expect(moofx.parse('color', "0%")).to.be("")
		expect(moofx.parse('color', "10%")).to.be("")

		expect(moofx.parse('color', "#000")).to.be("rgb(0,0,0)")
		expect(moofx.parse('color', "#0000")).to.be("rgba(0,0,0,0)")
		expect(moofx.parse('color', "#000f")).to.be("rgb(0,0,0)")
		expect(moofx.parse('color', "rgb(0, 0, 0, 0.5)")).to.be("rgba(0,0,0,0.5)")
		expect(moofx.parse('color', "rgba(0, 0, 0, 1)")).to.be("rgb(0,0,0)")
		expect(moofx.parse('color', "rgb(0,0,0)")).to.be("rgb(0,0,0)")
		expect(moofx.parse('color', "#ff330099")).to.be("rgba(255,51,0,0.6)")
		expect(moofx.parse('color', "#f309")).to.be("rgba(255,51,0,0.6)")

		// normalized
		expect(moofx.parse('color', "", true)).to.be("rgba(0,0,0,1)")
		expect(moofx.parse('color', undefined, true)).to.be("rgba(0,0,0,1)")
{'fraction_non_alphanumeric': 0.27599339850196775, 'fraction_numerical': 0.06360289450298337, 'mean_word_length': 5.543189368770764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5732404', 'n_tokens_mistral': 3756, 'n_tokens_neox': 3297, 'n_words': 456}