func main() { for _, mode := range []bool{false, true} { s5.TestMode = mode elem := s5.NewHtmlId("h3", "test1") dom := elem.Dom() TestData(dom, mode) TestCss(dom, mode) TestText(dom, mode) r := s5.NewRadioGroup("seuss") TestRadio(r, mode) t := s5.NewInputTextId("somethingelse") TestTextInput(t, mode) } print("all tests passed") }
import ( // JQUERY: Jquery allows many non type-safe operations. // Uses of jquery are marked in the code as they are suspect. "github.com/gopherjs/jquery" //"honnef.co/go/js/console" s5 "github.com/seven5/seven5/client" "strings" ) var ( //These are static references to the dom. They each specify a //single element. Maybe should be all upper case? Note that //it is preferred to access constrainable parts of the dom //that is fixed (in the page) through these objects. sectionMain = s5.NewHtmlId("section", "main") footer = s5.NewHtmlId("footer", "footer") primaryInput = s5.NewHtmlId("input", "new-todo") listContainer = s5.NewHtmlId("ul", "todo-list") pluralSpan = s5.NewHtmlId("span", "plural") todoCount = s5.NewHtmlId("span", "todo-count") clearCompleted = s5.NewHtmlId("button", "clear-completed") numCompleted = s5.NewHtmlId("span", "num-completed") toggleAll = s5.NewHtmlId("input", "toggle-all") //css classes used in the view view = s5.NewCssClass("view") toggle = s5.NewCssClass("toggle") destroy = s5.NewCssClass("destroy") edit = s5.NewCssClass("edit") completed = s5.NewCssClass("completed")