Comparing version 0.1.31 to 0.1.32-test
130
dist/sw.js
@@ -29,14 +29,102 @@ /** | ||
{ | ||
"url": "browser_compatibility.js", | ||
"revision": "a7879cfd30d48fc6f7e5fa0638b3e150" | ||
"url": "bulib-announce-98b942b3.js", | ||
"revision": "b3fd497e1d5d1436e1dabec64cb44cff" | ||
}, | ||
{ | ||
"url": "bulib-card-0e72f749.js", | ||
"revision": "a9a46a775fe9ca9ba1816d30c22114a7" | ||
}, | ||
{ | ||
"url": "bulib-color-b769a441.js", | ||
"revision": "4022990ed11a859cdc729044cc21313c" | ||
}, | ||
{ | ||
"url": "bulib-feedback-4df8ba9d.js", | ||
"revision": "6e547f84f2be337e7eb6f3e97afd654e" | ||
}, | ||
{ | ||
"url": "bulib-footer-47f4d3e1.js", | ||
"revision": "93c255c22e675cdb53d9d546164df648" | ||
}, | ||
{ | ||
"url": "bulib-hours-6762e369.js", | ||
"revision": "0c3b610e073d2810b8980bb63d908677" | ||
}, | ||
{ | ||
"url": "bulib-locoso-d1170736.js", | ||
"revision": "1b9e8fe6916695e29a7d0dcbec95f193" | ||
}, | ||
{ | ||
"url": "bulib-search-dd7a6f5f.js", | ||
"revision": "0668889cbcaac17b87b798deb716ef85" | ||
}, | ||
{ | ||
"url": "bundle.css", | ||
"revision": "8db48588e334deb4bfe4780b9c029263" | ||
"revision": "d021f1e6336cdef2a630b63688cbc0d3" | ||
}, | ||
{ | ||
"url": "bundle.esm.js", | ||
"revision": "ad441c130bc587f301e8307cf0f89360" | ||
"url": "google_analytix-b0686824.js", | ||
"revision": "3da095c6bc91689b7d8c58da6a3b9a4c" | ||
}, | ||
{ | ||
"url": "index-c2234bd6.js", | ||
"revision": "83f4a8f01c994aa52db8131cd170ff8a" | ||
}, | ||
{ | ||
"url": "index.html", | ||
"revision": "48fbe09c756901dc3d68c8bd1b6e1831" | ||
}, | ||
{ | ||
"url": "legacy/bulib-announce-d7a4e896.js", | ||
"revision": "872883c77de64ec2816e6268b8fbb20a" | ||
}, | ||
{ | ||
"url": "legacy/bulib-card-4c0e14b1.js", | ||
"revision": "e8fdaa17c08b93fe1f317dabff22d05a" | ||
}, | ||
{ | ||
"url": "legacy/bulib-color-00606457.js", | ||
"revision": "86b812cce824a2a995eb9aeecc5f2cd3" | ||
}, | ||
{ | ||
"url": "legacy/bulib-feedback-62126ea1.js", | ||
"revision": "fba43763ca5633e5280e11f30ef5e1f6" | ||
}, | ||
{ | ||
"url": "legacy/bulib-footer-e4443ccf.js", | ||
"revision": "bb2cddb9403aa5a9d8605b36137506c7" | ||
}, | ||
{ | ||
"url": "legacy/bulib-hours-1d69058c.js", | ||
"revision": "c05ce27ebb352807841fcd2c090992d2" | ||
}, | ||
{ | ||
"url": "legacy/bulib-locoso-fd3989c5.js", | ||
"revision": "0f5c23a157f9246372d1ef14701a4fb8" | ||
}, | ||
{ | ||
"url": "legacy/bulib-search-cca47d91.js", | ||
"revision": "f1cecd3e9886309ea7ba30ad551a5fc7" | ||
}, | ||
{ | ||
"url": "legacy/google_analytix-ad975198.js", | ||
"revision": "775c1a9c5f80756805d545b2f402f1d5" | ||
}, | ||
{ | ||
"url": "legacy/index-117a6492.js", | ||
"revision": "186c62e56b3491a062b0c7bec225c3a4" | ||
}, | ||
{ | ||
"url": "legacy/lib_info_helper-9bd5ac60.js", | ||
"revision": "a15a508fc3b37c3d4f84ff602abad6bc" | ||
}, | ||
{ | ||
"url": "legacy/lit-element-566adaa6.js", | ||
"revision": "0c9dbda90d91e3ba32be17c79aa23c80" | ||
}, | ||
{ | ||
"url": "lib_info_helper-e4c1363f.js", | ||
"revision": "56dc05407d5e880a4a3b3661f75f7fca" | ||
}, | ||
{ | ||
"url": "libanswers.css", | ||
@@ -58,6 +146,34 @@ "revision": "34ee3c6bc94c05cd7d8380549b5c0a49" | ||
{ | ||
"url": "search_redirector_override.js", | ||
"revision": "6d008349ab9498561cdf4f2370c17b08" | ||
"url": "lit-element-8f8db73c.js", | ||
"revision": "a3dd1a6b5f2b8c1024201b96632d13e3" | ||
}, | ||
{ | ||
"url": "polyfills/core-js.da8d8819d4fcddc05b82706be190ca82.js", | ||
"revision": "280dc6d955e57fd263fd0f3f9741c059" | ||
}, | ||
{ | ||
"url": "polyfills/custom-elements-es5-adapter.84b300ee818dce8b351c7cc7c100bcf7.js", | ||
"revision": "cff507bc95ad1d6bf1a415cc9c8852b0" | ||
}, | ||
{ | ||
"url": "polyfills/dynamic-import.991be47e17117abb5eb15f5254ad3869.js", | ||
"revision": "08b86a7f56c6f0d65265654299b16d74" | ||
}, | ||
{ | ||
"url": "polyfills/fetch.191258a74d74243758f52065f3d0962a.js", | ||
"revision": "fcdc4efda1fe1b52f814e36273ff745d" | ||
}, | ||
{ | ||
"url": "polyfills/regenerator-runtime.9090ed1c23690e3072c21a7873cad285.js", | ||
"revision": "9af9d9e480dfccc420d30729e319b821" | ||
}, | ||
{ | ||
"url": "polyfills/systemjs.6dfbfd8f2c3e558918ed74d133a6757a.js", | ||
"revision": "683aabfb9b006607885b83e45e9a1768" | ||
}, | ||
{ | ||
"url": "polyfills/webcomponents.6954abecfe8b165751e6bc9b0af6c639.js", | ||
"revision": "894a294495257c3d389efa3e1bd9bde7" | ||
}, | ||
{ | ||
"url": "wordpress.css", | ||
@@ -64,0 +180,0 @@ "revision": "b519ee5ee0b68015c57dff73a804a1c9" |
{ | ||
"name": "bulib-wc", | ||
"version": "0.1.31", | ||
"version": "0.1.32-test", | ||
"description": "collection of web components and styles used at Boston University Libraries", | ||
"type": "module", | ||
"main": "src/index.js", | ||
@@ -30,3 +29,5 @@ "module": "src/index.js", | ||
"pretest": "npm run build:css", | ||
"test": "karma start" | ||
"test": "karma start", | ||
"test:update-snapshots": "karma start --update-snapshots", | ||
"test:prune-snapshots": "karma start --prune-snapshots" | ||
}, | ||
@@ -50,25 +51,27 @@ "repository": { | ||
"dependencies": { | ||
"@webcomponents/webcomponentsjs": "^2.2.10", | ||
"lit-element": "^2.2.1", | ||
"lit-html": "^1.1.2" | ||
"@webcomponents/webcomponentsjs": "^2.4.3", | ||
"lit-element": "^2.3.1", | ||
"lit-html": "^1.2.1" | ||
}, | ||
"devDependencies": { | ||
"@open-wc/building-rollup": "^0.16.0", | ||
"@open-wc/demoing-storybook": "^1.0.1", | ||
"@open-wc/testing": "^2.0.0", | ||
"@open-wc/testing-karma": "^3.0.0", | ||
"@storybook/cli": "^5.2.3", | ||
"@storybook/storybook-deployer": "^2.8.1", | ||
"cypress": "^3.4.1", | ||
"deepmerge": "^3.2.0", | ||
"es-dev-server": "^1.5.0", | ||
"@open-wc/demoing-storybook": "^1.15.2", | ||
"@open-wc/semantic-dom-diff": "^0.17.9", | ||
"@open-wc/testing": "^2.5.16", | ||
"@open-wc/testing-karma": "^3.3.19", | ||
"@storybook/cli": "^5.3.18", | ||
"@storybook/storybook-deployer": "^2.8.5", | ||
"cypress": "^3.8.3", | ||
"deepmerge": "^3.3.0", | ||
"es-dev-server": "^1.48.1", | ||
"karma": "^5.0.5", | ||
"material-icons": "^0.3.1", | ||
"mocha": "^7.1.2", | ||
"node-sass": "^4.14.1", | ||
"npm-run-all": "^4.1.5", | ||
"rollup": "^1.19.4", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-babel-minify": "^9.0.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"scss": "^0.2.4", | ||
"web-component-analyzer": "^1.0.0", | ||
"webpack-merge": "^4.1.5" | ||
"web-component-analyzer": "^1.0.3" | ||
} | ||
} |
@@ -78,16 +78,21 @@ # bulib-wc [![npm package](https://img.shields.io/npm/v/bulib-wc.svg)](https://www.npmjs.com/package/bulib-wc) | ||
We expect to continue to manage versioning this repository with npm. | ||
We expect to continue to manage versioning this repository with npm, but we want to make sure that updates are synchronized | ||
(e.g. our demo site and github tags are all in sync), so we've made a script to help assist with that | ||
```bash | ||
$ npm publish | ||
$ npm run deploy | ||
``` | ||
that said, we want to make sure that our docs page is updated, so it's recommended to use the following, instead: | ||
we use semantic versioning ([semver](https://semver.org/)), and assume by default that you're publishing a `patch`. If you'd like to | ||
specify the level of change you're making (e.g. you want to mark a significant addition in functionality or a milestone in the project) | ||
you can specify `major` or `minor` as well: | ||
```bash | ||
$ npm run deploy | ||
$ npm run deploy [patch, major, minor] | ||
``` | ||
if you want to update the docs page before you're finished developing (without publishing the package), you can also update the _docs directly_ via | ||
Sometimes you may just want to update the storybook to demonstrate a change before you're finished developing | ||
(without publishing a new package for it on NPM) to verify the implementation is correct or desired functionality | ||
with a third party (like your advisor). You can update only the storybook by running the following: | ||
```bash | ||
@@ -114,4 +119,6 @@ $ npm run deploy:storybook | ||
For the **css**, we have both a shared bundle (created via `scripts/bundle_css.sh`), and site-specific forms for each `site_name`. | ||
These are imported via `<link>` like the following: | ||
For the **css**, we have both a shared "bundle" (created via `scripts/bundle_css.sh`), and site-specific forms for each `site_name`. | ||
These are imported via `<link>` like the following. Further customizations for each site are in `sites/**.css`. | ||
_NOTE: if you don't include the `bundle.min.css` stylesheet as well as the `index.js?module` in a given site, the styling for many components will be broken_ | ||
@@ -123,1 +130,3 @@ ```html | ||
``` | ||
An example of what all to include in each site's `<head>` is also available at `sites/shared.html`. |
import { html, fixture, expect } from '@open-wc/testing'; | ||
import './bulib-announce'; | ||
import { elementUpdated } from '@open-wc/testing-helpers'; | ||
import { aTimeout, elementUpdated } from '@open-wc/testing-helpers'; | ||
@@ -9,9 +9,10 @@ const elementIsHidden = (el) => { return el.offsetHeight == 0; } | ||
describe('bulib-announce', () => { | ||
it('to effectively load as a web component', async () => { | ||
it("renders effectively load as a web component", async () => { | ||
const el = await fixture(html`<bulib-announce></bulib-announce>`); | ||
expect(el.innerHTML).not.to.be.undefined; | ||
expect(el.innerHTML).to.include(`<span class="message">`) | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('to be hidden when dismissed is present', async () => { | ||
it("is hidden when 'dismissed' is present (but empty)", async () => { | ||
const el = await fixture(html`<bulib-announce dismissed></bulib-announce>`); | ||
@@ -21,5 +22,6 @@ expect(el.innerHTML).not.to.be.undefined; | ||
expect(elementIsHidden(innerDiv)).to.be.true; | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('to be hidden when dismissed is set to true', async () => { | ||
it("is hidden when 'dismissed' is set to 'true'", async () => { | ||
const el = await fixture(html`<bulib-announce dismissed="true"></bulib-announce>`); | ||
@@ -29,5 +31,6 @@ expect(el.innerHTML).not.to.be.undefined; | ||
expect(elementIsHidden(innerDiv)).to.be.true; | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('not to be hidden when dismissed is set to false', async () => { | ||
it("is NOT hidden when 'dismissed' is set to 'false'", async () => { | ||
const el = await fixture(html`<bulib-announce dismissed="false"></bulib-announce>`); | ||
@@ -37,12 +40,14 @@ expect(el.innerHTML).not.to.be.undefined; | ||
expect(elementIsHidden(innerDiv)).to.be.false; | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('the icon to change with the severity', async () => { | ||
it("responds to a custom 'severity' by changing the icon", async () => { | ||
const el = await fixture(html`<bulib-announce severity="warn"></bulib-announce>`); | ||
expect(el.innerHTML).not.to.be.undefined; | ||
let announceIcon = el.querySelector("div.announce-banner i"); | ||
expect(announceIcon.innerHTML).to.include('report_problem') | ||
expect(announceIcon.innerHTML).to.include('report_problem'); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it("that clicking 'dismiss' on a non-dismissed announce-banner dismisses it", async () => { | ||
it("disables the banner when the user clicks the dismiss button", async () => { | ||
let el = await fixture(html`<bulib-announce dismissed="false"></bulib-announce>`); | ||
@@ -61,12 +66,27 @@ let innerDiv = el.querySelector("div.announce-banner"); | ||
it("adding 'prevent_action' with an api-enabled code stops from loading API values", async () => { | ||
let el = await fixture(html`<bulib-announce debug code="primo" message="original message" prevent_action></bulib-announce>`); | ||
await elementUpdated(el); | ||
// click on the dismiss button and wait for the element to update | ||
it("renders an announcement-banner with a custom 'message'", async () => { | ||
const el = await fixture(html`<bulib-announce message="this is a custom message"></bulib-announce>`); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
let innerMessage = el.querySelector("div.announce-banner > .message"); | ||
expect(innerMessage.innerText).to.include("custom message"); | ||
}); | ||
// assert that the innerHTML changes and that the banner becomes hidden | ||
expect(innerMessage.innerText).to.include("original"); | ||
it("replaces the custom message when given an api-enabled 'code'", async () => { | ||
const el = await fixture(html`<bulib-announce code="testing" message="this is a custom message"></bulib-announce>`); | ||
// give time for the API to get called, and then check that the message is different than the above | ||
await aTimeout(800); | ||
let innerMsg = el.querySelector("div.announce-banner > .message"); | ||
expect(innerMsg.innerText).not.to.include("custom message"); | ||
}); | ||
it("does NOT replace the custom message when 'prevent_action' is there, regardless of the api-enabled code", async () => { | ||
let el = await fixture(html`<bulib-announce debug code="primo" message="custom message" prevent_action></bulib-announce>`); | ||
// give time for the API to get called, but expect it not to have been | ||
await aTimeout(800); | ||
let innerMsg = el.querySelector("div.announce-banner > .message"); | ||
expect(innerMsg.innerText).to.include("custom message"); | ||
}); | ||
}); |
@@ -6,3 +6,3 @@ import { html, fixture, expect } from '@open-wc/testing'; | ||
describe('bulib-card', () => { | ||
it('to effectively load as a web component', async () => { | ||
it('renders effectively as a web component', async () => { | ||
const el = await fixture(html` | ||
@@ -12,4 +12,5 @@ <bulib-card title="Home" icon="house" link="https://bu.edu/library" description="The description of the sample card."></bulib-card> | ||
expect(el.innerHTML).not.to.be.undefined; | ||
expect(el.innerHTML).to.include(`<div class="card">`) | ||
expect(el.innerHTML).to.include(`<div class="card">`); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
}); |
@@ -9,19 +9,23 @@ import { html, fixture, expect } from '@open-wc/testing'; | ||
it('to effectively load as a web component', async () => { | ||
it("renders effectively as a web component", async () => { | ||
const el = await fixture(html`<bulib-color></bulib-color>`) | ||
expect(el.renderRoot).not.to.undefined; | ||
expect(el.renderRoot.innerHTML).not.to.equal(""); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('to effectively default to a color when unspecified', async () => { | ||
const valElement = await fixture(html`<bulib-color></bulib-color>`) | ||
let actualBgColor = bgColorOfBulibColorElement(valElement); | ||
it("defaults to 'lightblue' when a 'val' and 'var' are both unspecified", async () => { | ||
const el = await fixture(html`<bulib-color></bulib-color>`) | ||
let actualBgColor = bgColorOfBulibColorElement(el); | ||
expect(actualBgColor).to.equal("lightblue"); | ||
}); | ||
it('to effectively set a specified background color value', async () => { | ||
const valElement = await fixture(html`<bulib-color val="red"></bulib-color>`) | ||
let actualBgColor = bgColorOfBulibColorElement(valElement); | ||
it("loads a specified background color value when 'val' is specified", async () => { | ||
const el = await fixture(html`<bulib-color val="red"></bulib-color>`) | ||
let actualBgColor = bgColorOfBulibColorElement(el); | ||
expect(actualBgColor).to.equal("red"); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
//TODO: troubleshoot the loading of --css-variables with 'var' | ||
}); |
@@ -1,2 +0,2 @@ | ||
import { html, fixture, expect } from '@open-wc/testing'; | ||
import { html, fixture, expect, elementUpdated } from '@open-wc/testing'; | ||
@@ -6,7 +6,15 @@ import './bulib-feedback'; | ||
describe('bulib-feedback', () => { | ||
it('to effectively load as a web component', async () => { | ||
const el = await fixture(html`<bulib-feedback code="feeback-test"></bulib-feedback>`); | ||
it("renders effectively as a web component", async () => { | ||
const el = await fixture(html`<bulib-feedback></bulib-feedback>`); | ||
expect(el.innerHTML).not.to.be.undefined; | ||
expect(el.innerHTML).to.include("helpful"); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it("thanks the user when they answer the prompt", async () => { | ||
const el = await fixture(html`<bulib-feedback></bulib-feedback>`); | ||
el.getElementsByTagName("button")[0].click(); | ||
await elementUpdated(el); | ||
expect(el.innerHTML).to.include("thanks"); | ||
}); | ||
}); |
@@ -6,22 +6,34 @@ import { html, fixture, expect } from '@open-wc/testing'; | ||
describe('bulib-footer', () => { | ||
it('to effectively load as a web component', async () => { | ||
it("renders effectively as a web component", async () => { | ||
const el = await fixture(html`<bulib-footer></bulib-footer>`); | ||
expect(el.renderRoot.innerHTML).not.to.be.undefined; | ||
expect(el.renderRoot.innerHTML).to.include("Copyright") | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('to contain \'bulib-locoso\'', async () => { | ||
it("includes copyright, privacy information, and a link to the BU Home page", async () => { | ||
// as specified in the 'BU website policy' [https://www.bu.edu/policies/website-policy/] | ||
const el = await fixture(html`<bulib-footer></bulib-footer>`); | ||
expect(el.renderRoot.innerHTML).to.include("Copyright"); | ||
expect(el.renderRoot.innerHTML).to.include("Privacy Statement"); | ||
expect(el.renderRoot.innerHTML).to.include("BU Home"); | ||
}); | ||
it("contains 'bulib-locoso'", async () => { | ||
const el = await fixture(html`<bulib-footer></bulib-footer>`); | ||
expect(el.renderRoot.innerHTML).to.include("bulib-locoso"); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('to set \'bulib-locoso\' library value from \'curr_url\'', async () => { | ||
it("sets 'bulib-locoso' library value from 'curr_url'", async () => { | ||
const el = await fixture(html`<bulib-footer curr_url="http://bu.libcal.com/booking/Pickering-quietstudy"></bulib-footer>`); | ||
expect(el.renderRoot.innerHTML).to.include("pickering"); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('to adjust sitemap to \`askalibrarian\' based on \'curr_url\'', async () => { | ||
it("adjusts the sitemap to `askalibrarian' based on 'curr_url'", async () => { | ||
const el = await fixture(html`<bulib-footer curr_url="https://askalibrarian.bu.edu"></bulib-footer>`); | ||
expect(el.renderRoot.innerHTML).to.include("Ask A Librarian"); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
}); |
import '@webcomponents/webcomponentsjs/webcomponents-loader'; | ||
WebComponents.waitFor(function(){ | ||
import ('./select/bulib-select'); | ||
import ('./feedback/bulib-feedback'); | ||
@@ -6,0 +5,0 @@ import ('./announce/bulib-announce'); |
@@ -6,3 +6,3 @@ import { html, fixture, expect } from '@open-wc/testing'; | ||
describe('bulib-hours', () => { | ||
it('to effectively load as a web component', async () => { | ||
it("renders effectively as a web component", async () => { | ||
const el = await fixture(html`<bulib-hours></bulib-hours>`); | ||
@@ -13,3 +13,3 @@ expect(el.innerHTML).not.to.be.undefined; | ||
it('to default to Mugar if no library is specified', async () => { | ||
it("defaults to the 'Mugar' library if no 'library' is specified", async () => { | ||
const el = await fixture(html`<bulib-hours></bulib-hours>`); | ||
@@ -19,3 +19,3 @@ expect(el.innerHTML).to.include("Mugar"); | ||
it('to effectively react to a specified \'library\'', async () => { | ||
it("effectively reacts to a specified 'library'", async () => { | ||
const el = await fixture(html`<bulib-hours library="sel"></bulib-hours>`); | ||
@@ -25,3 +25,9 @@ expect(el.innerHTML).to.include("SciEng"); | ||
it('setting \'long\' attribute shows location hours link', async () => { | ||
it("does NOT to show the library name or icon when 'short' is added", async () => { | ||
const el = await fixture(html`<bulib-hours short></bulib-hours>`); | ||
expect(el.innerHTML).not.to.include("<strong>"); | ||
expect(el.innerHTML).not.to.include('<img alt="clock-icon"'); | ||
}); | ||
it("shows the 'location hours' link when the 'long' attribute is added", async () => { | ||
const el = await fixture(html`<bulib-hours long></bulib-hours>`); | ||
@@ -28,0 +34,0 @@ expect(el.innerHTML).to.include("see all location hours"); |
@@ -6,9 +6,12 @@ import { html, fixture, expect } from '@open-wc/testing'; | ||
describe('bulib-locoso', () => { | ||
it('to effectively load as a web component', async () => { | ||
it("renders effectively as a web component", async () => { | ||
const el = await fixture(html`<bulib-locoso></bulib-locoso>`); | ||
expect(el.renderRoot.innerHTML).not.to.be.undefined; | ||
expect(el.renderRoot.innerHTML).to.include("Contact Us") | ||
expect(el.renderRoot.innerHTML).to.include("Visit Us"); | ||
expect(el.renderRoot.innerHTML).to.include("Contact Us"); | ||
expect(el.renderRoot.innerHTML).to.include("Follow Us"); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('not to contain \'bulib-hours\' by default', async () => { | ||
it("does NOT to contain 'bulib-hours' by default", async () => { | ||
const el = await fixture(html`<bulib-locoso></bulib-locoso>`); | ||
@@ -18,3 +21,3 @@ expect(el.renderRoot.innerHTML).not.to.include("bulib-hours"); | ||
it('to contain \'bulib-hours\' when library is specified', async () => { | ||
it("contains 'bulib-hours' when a 'library' is specified", async () => { | ||
const el = await fixture(html`<bulib-locoso library="sel"></bulib-locoso>`); | ||
@@ -21,0 +24,0 @@ expect(el.renderRoot.innerHTML).to.include("bulib-hours"); |
@@ -9,3 +9,3 @@ /** data on the overall search sources we have available to search on */ | ||
{"value":"industries", "name":"Industry Survey Locator", "placeholder": "Search for industry surveys", "domain":"https://buprimo.hosted.exlibrisgroup.com/primo-explore/search?vid=ISL&institution=BOSU&search_scope=default_scope&highlight=true&lang=en_US&query=any,contains,"}, | ||
{"value":"guides", "name":"Library Guides", "placeholder": "Search Research Guides", "domain":"http://library.bu.edu/srch.php?q="}, | ||
{"value":"guides", "name":"Library Guides", "placeholder": "Search research guides", "domain":"http://library.bu.edu/srch.php?q="}, | ||
{"value":"openbu", "name":"Open BU", "placeholder": "Search BU Digital Collections", "domain":"https://open.bu.edu/discover?query="}, | ||
@@ -12,0 +12,0 @@ {"value":"db", "name":"BU Databases", "placeholder": "Search for databases", "domain":"http://library.bu.edu/az.php?q="}, |
import {LitElement, html, css} from 'lit-element/lit-element'; | ||
import {search_options} from './search_options'; | ||
import {sendGAEvent} from '../_helpers/google_analytix'; | ||
const ENTER_KEY_VALUE = 13; | ||
const default_to_just_primo = true; | ||
@@ -167,3 +166,3 @@ const search_option_codes = search_options.map( x => x.value ); | ||
if(!this.str_options || this.str_options === ""){ | ||
this.str_options = default_to_just_primo? ["primo"] : search_options; | ||
this.str_options = ["primo"]; this.str_selected = "primo"; | ||
} | ||
@@ -182,5 +181,3 @@ | ||
// set 'str_selected', defaulting to the first 'option' | ||
if(Object.keys(this._selected).length == 0){ | ||
this._selected = _getOptionFromCode(this.str_selected, this._options); | ||
} | ||
this._selected = _getOptionFromCode(this.str_selected, this._options); | ||
} | ||
@@ -187,0 +184,0 @@ |
@@ -6,31 +6,31 @@ import { html, fixture, expect } from '@open-wc/testing'; | ||
describe('bulib-search', () => { | ||
it('to effectively load as a web component', async () => { | ||
it("renders effectively as a web component", async () => { | ||
const el = await fixture(html`<bulib-search></bulib-search>`); | ||
expect(el.renderRoot.innerHTML).not.to.be.undefined; | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('to default to the primo search', async () => { | ||
it("defaults to the 'primo' search, with no other options when empty", async () => { | ||
const el = await fixture(html`<bulib-search></bulib-search>`); | ||
expect(el.renderRoot.innerHTML).not.to.include(`placeholder="Search library resources"`); | ||
expect(el.renderRoot.innerHTML).to.include(`placeholder="Search library resources"`); | ||
expect(el.renderRoot.innerHTML).not.to.include(`type="radio"`); | ||
}); | ||
it('to effectively update the search option when a single item specified', async () => { | ||
it("effectively updates the search option when a single 'str_options' item specified", async () => { | ||
const el = await fixture(html`<bulib-search str_options="guides"></bulib-search>`); | ||
expect(el.renderRoot.innerHTML).to.include(`placeholder="Search Research Guides"`); | ||
expect(el.renderRoot.innerHTML).to.include(`placeholder="Search research guides"`); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('to not have any other options when nothing is specified', async () => { | ||
const el = await fixture(html`<bulib-search></bulib-search>`); | ||
expect(el.renderRoot.innerHTML).not.to.include(`type="radio"`); | ||
}); | ||
it('to display options when multiple \'str_options\' are specified', async () => { | ||
const el = await fixture(html`<bulib-search str_options="primo wp "></bulib-search>`); | ||
it("displays all options when multiple 'str_options' are specified", async () => { | ||
const el = await fixture(html`<bulib-search str_options="primo wp guides"></bulib-search>`); | ||
expect(el.renderRoot.innerHTML).to.include(`type="radio"`); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
it('to support the specification of a particular \'str_options\' (\'str_selected\')', async () => { | ||
it("supports the specification of a particular 'str_selected' from the 'str_options'", async () => { | ||
const el = await fixture(html`<bulib-search str_options="primo wp guides" str_selected="wp"></bulib-search>`); | ||
expect(el.renderRoot.innerHTML).to.include(`placeholder="Search library info/services"`); | ||
expect(el).lightDom.to.equalSnapshot(); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2070160
140
5249
129
19
12
No
Updatedlit-element@^2.3.1
Updatedlit-html@^1.2.1