UNPKG

solid-panes

Version:

Solid-compatible Panes: applets and views for the mashlib and databrowser

27 lines (25 loc) 1.31 kB
"use strict"; var _util = require("util"); var _rdflib = require("rdflib"); var _propertyViews = require("./propertyViews"); /* eslint-env jest */ global.TextEncoder = _util.TextEncoder; global.TextDecoder = _util.TextDecoder; describe('property views', function () { it.each(['http://xmlns.com/foaf/0.1/depiction', 'http://xmlns.com/foaf/0.1/img', 'http://xmlns.com/foaf/0.1/thumbnail', 'http://xmlns.com/foaf/0.1/logo', 'http://schema.org/image'])('renders %s as image', function (property) { var views = (0, _propertyViews.propertyViews)(document); var view = views.defaults[property]; var result = view((0, _rdflib.sym)('https://pod.example/img.jpg')); expect(result).toBeInstanceOf(HTMLImageElement); expect(result).toHaveAttribute('src', 'https://pod.example/img.jpg'); }); it.each(['http://xmlns.com/foaf/0.1/mbox'])('renders %s as anchor', function (property) { var views = (0, _propertyViews.propertyViews)(document); var view = views.defaults[property]; var result = view((0, _rdflib.sym)('mailto:alice@mail.example')); expect(result).toBeInstanceOf(HTMLAnchorElement); expect(result).toHaveAttribute('href', 'mailto:alice@mail.example'); expect(result).toHaveTextContent('alice@mail.example'); }); }); //# sourceMappingURL=propertyViews.test.js.map