|
648 | 648 | } |
649 | 649 | })); |
650 | 650 |
|
| 651 | + ["flex", "-ms-flex", "-webkit-flex"].forEach(function(prop_name) { |
| 652 | + suite.add(new ValidationTestCase({ |
| 653 | + property: prop_name, |
| 654 | + |
| 655 | + valid: [ |
| 656 | + "1", |
| 657 | + "inherit", |
| 658 | + // From http://www.w3.org/TR/2014/WD-css-flexbox-1-20140325/#flex-common |
| 659 | + // "initial", // FIXME this needs to be integrated as a univerally acceptable value |
| 660 | + "0 auto", |
| 661 | + "0 1 auto", |
| 662 | + "auto", |
| 663 | + "none", |
| 664 | + "1 1 0%" |
| 665 | + ], |
| 666 | + |
| 667 | + invalid: { |
| 668 | + "foo": "Expected (none | [ <flex-grow> <flex-shrink>? || <flex-basis> ]) but found 'foo'." |
| 669 | + } |
| 670 | + })); |
| 671 | + }); |
| 672 | + |
| 673 | + ["flex-basis", "-webkit-flex-basis"].forEach(function(prop_name) { |
| 674 | + suite.add(new ValidationTestCase({ |
| 675 | + property: prop_name, |
| 676 | + |
| 677 | + valid: [ |
| 678 | + // "initial", // FIXME this needs to be integrated as a univerally acceptable value |
| 679 | + "auto", |
| 680 | + "12px", |
| 681 | + "3em", |
| 682 | + "0" |
| 683 | + ], |
| 684 | + |
| 685 | + invalid: { |
| 686 | + "foo": "Expected (<width>) but found 'foo'." |
| 687 | + } |
| 688 | + })); |
| 689 | + }); |
| 690 | + |
| 691 | + ["flex-direction", "-ms-flex-direction", "-webkit-flex-direction"].forEach(function(prop_name) { |
| 692 | + var prop_definition = "row | row-reverse | column | column-reverse"; |
| 693 | + if (prop_name == "-ms-flex-direction") { |
| 694 | + prop_definition += " | inherit"; |
| 695 | + } |
| 696 | + var valid_values = [ |
| 697 | + // "initial", // FIXME this needs to be integrated as a univerally acceptable value |
| 698 | + "row", |
| 699 | + "row-reverse", |
| 700 | + "column", |
| 701 | + "column-reverse" |
| 702 | + ]; |
| 703 | + if (prop_name == "-ms-flex-direction") { |
| 704 | + valid_values.push("inherit"); |
| 705 | + } |
| 706 | + suite.add(new ValidationTestCase({ |
| 707 | + property: prop_name, |
| 708 | + |
| 709 | + valid: valid_values, |
| 710 | + |
| 711 | + invalid: { |
| 712 | + "foo": "Expected (" + prop_definition + ") but found 'foo'." |
| 713 | + } |
| 714 | + })); |
| 715 | + }); |
| 716 | + |
| 717 | + ["flex-flow", "-webkit-flex-flow"].forEach(function(prop_name) { |
| 718 | + suite.add(new ValidationTestCase({ |
| 719 | + property: prop_name, |
| 720 | + |
| 721 | + valid: [ |
| 722 | + // "initial", // FIXME this needs to be integrated as a univerally acceptable value |
| 723 | + // from http://www.w3.org/TR/2014/WD-css-flexbox-1-20140325/#flex-flow-property |
| 724 | + "row", |
| 725 | + "column wrap", |
| 726 | + "row-reverse wrap-reverse", |
| 727 | + "wrap" |
| 728 | + ], |
| 729 | + |
| 730 | + invalid: { |
| 731 | + "foo": "Expected (<flex-direction> || <flex-wrap>) but found 'foo'." |
| 732 | + } |
| 733 | + })); |
| 734 | + }); |
| 735 | + |
| 736 | + ["flex-grow", "-webkit-flex-grow"].forEach(function(prop_name) { |
| 737 | + suite.add(new ValidationTestCase({ |
| 738 | + property: prop_name, |
| 739 | + |
| 740 | + valid: [ |
| 741 | + // "initial", // FIXME this needs to be integrated as a univerally acceptable value |
| 742 | + "0", |
| 743 | + "1", |
| 744 | + "1.5" |
| 745 | + ], |
| 746 | + |
| 747 | + invalid: { |
| 748 | + "foo": "Expected (<number>) but found 'foo'." |
| 749 | + } |
| 750 | + })); |
| 751 | + }); |
| 752 | + |
| 753 | + ["flex-shrink", "-webkit-flex-shrink"].forEach(function(prop_name) { |
| 754 | + suite.add(new ValidationTestCase({ |
| 755 | + property: prop_name, |
| 756 | + |
| 757 | + valid: [ |
| 758 | + // "initial", // FIXME this needs to be integrated as a univerally acceptable value |
| 759 | + "0", |
| 760 | + "1", |
| 761 | + "1.5" |
| 762 | + ], |
| 763 | + |
| 764 | + invalid: { |
| 765 | + "foo": "Expected (<number>) but found 'foo'." |
| 766 | + } |
| 767 | + })); |
| 768 | + }); |
| 769 | + |
| 770 | + ["flex-wrap", "-ms-flex-wrap", "-webkit-flex-wrap"].forEach(function(prop_name) { |
| 771 | + suite.add(new ValidationTestCase({ |
| 772 | + property: prop_name, |
| 773 | + |
| 774 | + valid: [ |
| 775 | + // "initial", // FIXME this needs to be integrated as a univerally acceptable value |
| 776 | + "nowrap", |
| 777 | + "wrap", |
| 778 | + "wrap-reverse" |
| 779 | + ], |
| 780 | + |
| 781 | + invalid: { |
| 782 | + "foo": "Expected (nowrap | wrap | wrap-reverse) but found 'foo'." |
| 783 | + } |
| 784 | + })); |
| 785 | + }); |
| 786 | + |
651 | 787 | suite.add(new ValidationTestCase({ |
652 | 788 | property: "text-rendering", |
653 | 789 |
|
|
0 commit comments