MCPcopy
hub / github.com/grafana/k6 / TestGenElementsIntProperties

Function TestGenElementsIntProperties

js/modules/k6/html/elements_gen_test.go:328–367  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

326}
327
328func TestGenElementsIntProperties(t *testing.T) {
329 t.Parallel()
330 rt := getTestRuntimeWithDoc(t, testGenElems)
331
332 intTests := []struct {
333 id string
334 property string
335 data int
336 }{
337 {"img1", "width", 100},
338 {"img1", "height", 50},
339 {"input7", "maxLength", 10},
340 {"input7", "size", 5},
341 {"li1", "value", 0},
342 {"li2", "value", 10},
343 {"meter1", "min", 90},
344 {"meter1", "max", 110},
345 {"meter1", "low", 95},
346 {"meter1", "high", 105},
347 {"meter1", "optimum", 100},
348 {"object1", "tabIndex", 6},
349 {"ol1", "start", 1},
350 {"td1", "colSpan", 2},
351 {"td1", "rowSpan", 3},
352 {"th1", "colSpan", 1},
353 {"th1", "colSpan", 1},
354 {"txtarea1", "rows", 10},
355 {"txtarea1", "cols", 12},
356 {"txtarea1", "maxLength", 128},
357 {"txtarea1", "tabIndex", 4},
358 }
359 for _, test := range intTests {
360 v, err := rt.RunString(`doc.find("#` + test.id + `").get(0).` + test.property + `()`)
361 if err != nil {
362 t.Errorf("Error for property name '%s' on element id '#%s':\n%+v", test.property, test.id, err)
363 } else if v.Export() != int64(test.data) {
364 t.Errorf("Expected %d for property name '%s' on element id '#%s'. Got %d", test.data, test.property, test.id, v.ToInteger())
365 }
366 }
367}
368
369func TestGenElementsNullProperties(t *testing.T) {
370 t.Parallel()

Callers

nothing calls this directly

Calls 3

getTestRuntimeWithDocFunction · 0.85
ErrorfMethod · 0.80
ExportMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…