R/Test/colour.R

Defines functions test.setToggleHoveColour test.setTabHoverColour test.setTabColour test.setActiveTabColour test.setSideBarColour test.setNavBarColour test.setLogoHoverColour test.setLogoColour

# Colour test @shinyStat
# 
# sets dashboard colours
#
# elh

test.setLogoColour <- function()
{
  checkTrue(existsFunction("setLogoColour"))
  checkEquals(setLogoColour("AAAAAA"),paste0(".skin-blue .main-header .logo {background-color:#AAAAAA;}"))
  checkException(setLogoColour(), 'argument "rrggbb" is missing, with no default')
  checkException(setLogoColour("A"), "Error: nchar(rrggbb) == 6 is not TRUE")
}

test.setLogoHoverColour <- function()
{
  checkTrue(existsFunction("setLogoHoverColour"))
  checkEquals(setLogoHoverColour("AAAAAA"),paste0(".skin-blue .main-header .logo:hover {background-color:#AAAAAA;}"))
  checkException(setLogoHoverColour(), 'argument "rrggbb" is missing, with no default')
  checkException(setLogoHoverColour("A"), "Error: nchar(rrggbb) == 6 is not TRUE")
}
test.setNavBarColour <- function()
{
  checkTrue(existsFunction("setNavBarColour"))
  checkEquals(setNavBarColour("AAAAAA"), paste0(".skin-blue .main-header .navbar {background-color:#AAAAAA;}"))
  checkException(setNavBarColour(), 'argument "rrggbb" is missing, with no default')
  checkException(setNavBarColour("A"), "Error: nchar(rrggbb) == 6 is not TRUE")
}

test.setSideBarColour <- function()
{
  checkTrue(existsFunction("setSideBarColour"))
  checkEquals(setSideBarColour("AAAAAA"), paste0(".skin-blue .main-sidebar {background-color:#AAAAAA;}"))
  checkException(setSideBarColour(), 'argument "rrggbb" is missing, with no default')
  checkException(setSideBarColour("A"), "Error: nchar(rrggbb) == 6 is not TRUE")
}
 
test.setActiveTabColour <- function()
{
  checkTrue(existsFunction("setActiveTabColour"))
  checkEquals(setActiveTabColour("AAAAAA", "BBBBBB"), paste0(".skin-blue .main-sidebar .sidebar .sidebar-menu .active a{background-color:#AAAAAA;color:#BBBBBB;}"))
  checkException(setSideBarColour(), 'argument "fg" is missing, with no default')
  checkException(setSideBarColour(), 'argument "fg" is missing, with no default')
  checkException(setSideBarColour("A", "BBBBBB"), "Error: nchar(bg) == 6 is not TRUE")
  checkException(setSideBarColour("AAAAAA", "B"), "Error: nchar(fg) == 6 is not TRUE")
}
  

test.setTabColour <- function()
{
  checkTrue(existsFunction("setTabColour"))
  checkEquals(setTabColour("AAAAAA", "BBBBBB"), paste0(".skin-blue .main-sidebar .sidebar .sidebar-menu a{background-color:#AAAAAA;color:#BBBBBB;}"))
  checkException(setTabColour(), 'argument "fg" is missing, with no default')
  checkException(setTabColour(), 'argument "fg" is missing, with no default')
  checkException(setTabColour("A", "BBBBBB"), "Error: nchar(bg) == 6 is not TRUE")
  checkException(setTabColour("AAAAAA", "B"), "Error: nchar(fg) == 6 is not TRUE")
}

test.setTabHoverColour <- function()
{
  checkTrue(existsFunction("setTabHoverColour"))
  checkEquals(setTabHoverColour("AAAAAA", "BBBBBB"), paste0(".skin-blue .main-sidebar .sidebar .sidebar-menu a:hover{background-color:#AAAAAA;color:#BBBBBB;}"))
  checkException(setTabHoverColour(), 'argument "fg" is missing, with no default')
  checkException(setTabHoverColour(), 'argument "fg" is missing, with no default')
  checkException(setTabHoverColour("A", "BBBBBB"), "Error: nchar(bg) == 6 is not TRUE")
  checkException(setTabHoverColour("AAAAAA", "B"), "Error: nchar(fg) == 6 is not TRUE")
}

test.setToggleHoveColour <- function()
{
  checkTrue(existsFunction("setToggleHoveColour"))
  checkEquals(setToggleHoveColour("AAAAAA"), paste0(".skin-blue .main-header .navbar .sidebar-toggle:hover{background-color:#AAAAAA;}"))
  checkException(setToggleHoveColour(), 'argument "rrggbb" is missing, with no default')
  checkException(setToggleHoveColour("A"), "Error: nchar(rrggbb) == 6 is not TRUE")
}
gaspardcc/PMMMF documentation built on March 22, 2018, 6:52 a.m.