MCPcopy
hub / github.com/layui/layui / describe

Method describe

examples/test/test.js:60–89  ·  view source on GitHub ↗
(opts, fn)

Source from the content-addressed store, hash-verified

58 };
59
60 describe(opts, fn) {
61 const { el } = this.options;
62
63 if (typeof opts === 'string') {
64 opts = {
65 title: opts,
66 id: opts
67 };
68 }
69
70 const describer = (this.describer = lay.extend(
71 {
72 suiteElem: lay.elem('div', {
73 class: 'layui-text test-suite',
74 id: opts.id
75 }),
76 itemsElem: lay.elem('div', {
77 class: 'test-items'
78 })
79 },
80 opts
81 ));
82
83 lay(describer.suiteElem).append(`<h2>${opts.title} : </h2>`);
84 lay(describer.suiteElem).append(describer.itemsElem);
85 el.append(describer.suiteElem);
86
87 fn?.(this.#it.bind(this));
88 return this;
89 }
90
91 #it(opts = {}) {
92 let { code, expected, title, assert } = opts;

Callers

nothing calls this directly

Calls 2

layFunction · 0.85
fnFunction · 0.85

Tested by

no test coverage detected