1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Add specs for wtf.ChecklistItem

This commit is contained in:
Chris Cummer
2018-07-12 17:51:23 -07:00
parent 5ebab79e2c
commit 857702e971
2 changed files with 47 additions and 0 deletions

View File

@@ -1,10 +1,13 @@
package wtf
// ChecklistItem is a module for creating generic checklist implementations
// See 'Todo' for an implementation example
type ChecklistItem struct {
Checked bool
Text string
}
// CheckMark returns the string used to indicate a ChecklistItem is checked or unchecked
func (item *ChecklistItem) CheckMark() string {
if item.Checked {
return Config.UString("wtf.mods.todo.checkedIcon", "x")
@@ -13,6 +16,8 @@ func (item *ChecklistItem) CheckMark() string {
}
}
// Toggle changes the checked state of the ChecklistItem
// If checked, it is unchecked. If unchecked, it is checked
func (item *ChecklistItem) Toggle() {
item.Checked = !item.Checked
}