<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Writing Modes: parsing text-combine-upright with invalid values</title>
<link rel="author" title="Masataka Yakura" href="http://google.com/+MasatakaYakura">
<link rel="help" href="http://www.w3.org/TR/css-writing-modes-4/#text-combine-upright">
<meta name="assert" content="text-combine-upright doesn't support undefined keywords and out-of-range integer, and numbers.">
<meta name="flags" content="dom invalid">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<style>
#invalid_foo {
  text-decoration-upright: foo;
}

#invalid_all_none {
  text-decoration-upright: all none;
}

#invalid_none_digits {
  text-decoration-upright: none digits;
}

#invalid_digits_bar {
  text-decoration-upright: digits bar;
}

#invalid_digits_4_none {
  text-decoration-upright: digits 4 none;
}

#invalid_digits2 {
  text-decoration-upright: digits2;
}

#invalid_digits_1 {
  text-decoration-upright: digits 1;
}

#invalid_digits_positive5 {
  text-decoration-upright: digits +5;
}

#invalid_digits_2_00 {
  text-decoration-upright: digits 2.00;
}

#invalid_digits_2_e_0 {
  text-decoration-upright: digits 2e0;
}

#invalid_digits_positive2_e_0 {
  text-decoration-upright: digits +2e0;
}

#invalid_digits_3_e_positive0 {
  text-decoration-upright: digits 3e+0;
}

#invalid_digits_3_e_negative0 {
  text-decoration-upright: digits 3e-0;
}

#invalid_digits_positive4_e_positive0 {
  text-decoration-upright: digits +4e+0;
}

#invalid_digits_positive4_e_negative0 {
  text-decoration-upright: digits +4e-0;
}
</style>
</head>
<body>

<div id="invalid_foo"></div>
<div id="invalid_all_none"></div>
<div id="invalid_none_digits"></div>
<div id="invalid_digits_bar"></div>
<div id="invalid_digits_4_none"></div>
<div id="invalid_digits2"></div>
<div id="invalid_digits_1"></div>
<div id="invalid_digits_positive5"></div>
<div id="invalid_digits_2_00"></div>
<div id="invalid_digits_2_e_0"></div>
<div id="invalid_digits_positive2_e_0"></div>
<div id="invalid_digits_3_e_positive0"></div>
<div id="invalid_digits_3_e_negative0"></div>
<div id="invalid_digits_positive4_e_positive0"></div>
<div id="invalid_digits_positive4_e_negative0"></div>

<div id="log"></div>

<script>
var getComputedValueFor = function (id) {
  var element = document.getElementById(id);
  return window.getComputedStyle(element).textCombineUpright;
};

test(function () {
  assert_equals(getComputedValueFor('invalid_foo'), 'none');
}, 'Computed value for `text-combine-upright: foo` is `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_all_none'), 'none');
}, 'Computed value for `text-combine-upright: all none` is `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_none_digits'), 'none');
}, 'Computed value for `text-combine-upright: none digits` is `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_bar'), 'none');
}, 'Computed value for `text-combine-upright: digits bar` is `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_4_none'), 'none');
}, 'Computed value for `text-combine-upright: digits 4 none` is `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits2'), 'none');
}, 'Computed value for `text-combine-upright: digits2` is `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_1'), 'none');
}, 'Computed value for `text-combine-upright: digits 1` is `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_positive5'), 'none');
}, 'Computed value for `text-combine-upright: digits +5` is `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_2_00'), 'none');
}, 'Computed value for `text-combine-upright: digits 2.00` is `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_2_e_0'), 'none');
  assert_not_equals(getComputedValueFor('invalid_digits_2_e_0'), 'digits 2');
}, 'Computed value for `text-combine-upright: digits 2e0` is not `digits 2` but `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_positive2_e_0'), 'none');
  assert_not_equals(getComputedValueFor('invalid_digits_positive2_e_0'), 'digits 2');
}, 'Computed value for `text-combine-upright: digits +2e0` is not `digits 2` but `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_3_e_positive0'), 'none');
  assert_not_equals(getComputedValueFor('invalid_digits_3_e_positive0'), 'digits 3');
}, 'Computed value for `text-combine-upright: digits 3e+0` is not `digits 3` but `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_3_e_negative0'), 'none');
  assert_not_equals(getComputedValueFor('invalid_digits_3_e_negative0'), 'digits 3');
}, 'Computed value for `text-combine-upright: digits 3e-0` is not `digits 3` but `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_positive4_e_positive0'), 'none');
  assert_not_equals(getComputedValueFor('invalid_digits_positive4_e_positive0'), 'digits 4');
}, 'Computed value for `text-combine-upright: digits +4e+0` is not `digits 4` but `none`');

test(function () {
  assert_equals(getComputedValueFor('invalid_digits_positive4_e_negative0'), 'none');
  assert_not_equals(getComputedValueFor('invalid_digits_positive4_e_negative0'), 'digits 4');
}, 'Computed value for `text-combine-upright: digits +4e-0` is not `digits 4` but `none`');
</script>
</body>
</html>