commit display record type in demo UI
This commit is contained in:
Родитель
4a5804e307
Коммит
3b7d6bed44
1
demo.js
1
demo.js
|
@ -25,6 +25,7 @@ search.addWidget(
|
|||
templates: {
|
||||
empty: 'No results',
|
||||
item: `
|
||||
{{{_highlightResult.type.value}}}
|
||||
<b>{{{_highlightResult.title.value}}}</b> -
|
||||
{{{_highlightResult.tldr.value}}}
|
||||
`
|
||||
|
|
7
test.js
7
test.js
|
@ -7,7 +7,7 @@ test('electron-search', t => {
|
|||
// All Entries
|
||||
// ----------------------------------------------------------------------
|
||||
t.ok(Array.isArray(entries), 'is an array')
|
||||
t.ok(entries.length > 5, 'with hella entries')
|
||||
t.ok(entries.length > 500, 'with hella entries')
|
||||
entries.forEach(entry => {
|
||||
t.ok(types.includes(entry.type), `${entry.title} has a known type`)
|
||||
})
|
||||
|
@ -16,7 +16,7 @@ test('electron-search', t => {
|
|||
// ----------------------------------------------------------------------
|
||||
const apis = entries.filter(entry => entry.type === 'api')
|
||||
|
||||
t.ok(apis.length > 5, 'lots of APIs')
|
||||
t.ok(apis.length > 450, 'lots of APIs')
|
||||
|
||||
let staticMethod = apis.find(api => api.title === 'Menu.getApplicationMenu()')
|
||||
t.equal(staticMethod.url, 'https://electronjs.org/docs/api/menu#menugetapplicationmenu', 'sets proper URL on static methods')
|
||||
|
@ -34,11 +34,14 @@ test('electron-search', t => {
|
|||
// ----------------------------------------------------------------------
|
||||
const tutorials = entries.filter(entry => entry.type === 'tutorial')
|
||||
|
||||
t.ok(tutorials.length > 25, 'lots of tutorials')
|
||||
|
||||
tutorials.forEach(tutorial => {
|
||||
if (!tutorial.title) console.log(tutorial)
|
||||
t.equal(typeof tutorial.title, 'string', `${tutorial.title} has a title`)
|
||||
t.equal(typeof tutorial.body, 'string', `${tutorial.title} has a body`)
|
||||
t.ok(isURL(tutorial.githubUrl), `${tutorial.title} has a valid GitHub URL`)
|
||||
t.ok(isURL(tutorial.url), `${tutorial.title} has a valid website URL`)
|
||||
})
|
||||
|
||||
// Packages
|
||||
|
|
Загрузка…
Ссылка в новой задаче