-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(theme-preset): Streamline S3 classes, store theme info in sass variables #644
Changes from 20 commits
c1464d1
a62975b
4f30b76
5c902cc
fbf656b
62f320c
28ddfb3
c891fb8
0c17392
7805b89
b4eff4f
586dc6f
c6cade0
132386a
160360b
1a602d2
41f8aa8
2f95827
17112ee
d17a40d
7e26ba3
3c44cc3
2150ba8
65fe8a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
test_that("theme_version() works for current versions", { | ||
bs_versions <- versions() | ||
|
||
for (bs_v in bs_versions) { | ||
expect_equal(theme_version(bs_theme(!!bs_v)), !!bs_v) | ||
} | ||
}) | ||
|
||
test_that("theme_version() uses class first, then sass bundle", { | ||
theme <- theme_unclassed <- bs_theme(version = 5) | ||
class(theme_unclassed) <- setdiff(class(theme), "bs_version_5") | ||
theme_99 <- add_class(theme_unclassed, "bs_version_99") | ||
|
||
# These should use the class information | ||
expect_equal(theme_version(theme), "5") | ||
expect_equal(theme_version(theme_99), "99") | ||
|
||
# These should consult the sass bundle | ||
expect_equal(theme_version(add_class(theme, "bs_version_99")), "5") | ||
expect_equal(theme_version(theme_unclassed), "5") | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still doesn't feel quite right that
$theme_class
exists. Could we get rid of it, and do something like this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind, I made the change to a constant in 3c44cc3.
The reason I didn't originally was because it felt like
preset$type
being NULL was an indirect signal of whether this class should be added. I includedpreset$theme_class
so that if we changed that assumption later we'd only need to reason about thepreset
object.But the problem is that we have to remove preset the preset class as part of
bs_theme_update()
... so I'm on board with constant as a the signal that we're doing something special.