Skip to content

Commit 3187885

Browse files
committed
added types
1 parent e94ab56 commit 3187885

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/widgets/peopleSearch.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* - Assumes that the user has a type index entry for vcard:AddressBook. @@ bad assuption
1919
*
2020
*/
21-
import { NamedNode } from 'rdflib'
21+
import { NamedNode, type LiveStore } from 'rdflib'
2222
import ContactsModuleRdfLib, { type AddressBook } from '@solid-data-modules/contacts-rdflib'
2323
import * as debug from '../debug'
2424
import { ns } from '..'
@@ -36,7 +36,12 @@ type PersonEntry = {
3636
relationshipLabel: 'Friend' | 'People' | 'Contact'
3737
}
3838

39-
export const createPeopleSearch = function (dom, kb, me: NamedNode | null, onClickHandler?: (person: PersonEntry) => void) {
39+
export const createPeopleSearch = function (
40+
dom: HTMLDocument,
41+
kb: LiveStore,
42+
me: NamedNode | null,
43+
onClickHandler?: (person: PersonEntry) => void
44+
): HTMLFormElement {
4045
const contactsModule = new ContactsModuleRdfLib({
4146
store: kb,
4247
fetcher: kb.fetcher,
@@ -353,7 +358,7 @@ export const createPeopleSearch = function (dom, kb, me: NamedNode | null, onCli
353358
const contactNode = new NamedNode(contactUri)
354359
const webIdPromise = kb.fetcher.load(contactNode.doc())
355360
.then(function () {
356-
const webIdNode = kb.any(contactNode, ns.vcard('url'), undefined, contactNode.doc())
361+
const webIdNode = kb.any(contactNode, ns.vcard('url'), undefined, contactNode.doc()) as NamedNode | null
357362
if (!webIdNode) return null
358363

359364
return kb.anyValue(webIdNode, ns.vcard('value'), undefined, contactNode.doc()) || null

test/unit/widgets/peopleSearch.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ describe('createPeopleSearch', () => {
210210
personRow?.dispatchEvent(new Event('click'))
211211

212212
expect(openSpy).toHaveBeenCalledTimes(1)
213-
expect(openSpy).toHaveBeenCalledWith('https://alice.example/profile/card#me', '_blank')
213+
expect(openSpy).toHaveBeenCalledWith('https://alice.example/profile/card#me', '_blank', 'noopener,noreferrer')
214214
expect(dropdown.style.display).toBe('none')
215215

216216
openSpy.mockRestore()

0 commit comments

Comments
 (0)