From 01a273cc07b0d183cf89b430964988ae12b96479 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 2 Dec 2024 16:25:05 -0500 Subject: [PATCH] chore: Error if `...` includes unused options --- R/navs-legacy.R | 2 ++ tests/testthat/test-navs-legacy.R | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/R/navs-legacy.R b/R/navs-legacy.R index ad8626c9d..2ed977f69 100644 --- a/R/navs-legacy.R +++ b/R/navs-legacy.R @@ -216,6 +216,8 @@ navbar_options <- function( underline = missing(underline) ) + rlang::check_dots_empty() + opts <- list( position = rlang::arg_match(position), bg = bg, diff --git a/tests/testthat/test-navs-legacy.R b/tests/testthat/test-navs-legacy.R index 85a7882ed..4847aac21 100644 --- a/tests/testthat/test-navs-legacy.R +++ b/tests/testthat/test-navs-legacy.R @@ -20,6 +20,10 @@ test_that("navbar_options() print method", { ) }) +test_that("navbar_options() errors if ... swallows unused options", { + expect_error(navbar_options(foo = "bar")) +}) + test_that("navbar_options_resolve_deprecated() consolidates correctly", { # TODO-deprecated: Remove when direction options are deprecated with an error