@operato/input 10.29.30 → 10.29.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +776 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/webpack/bootstrap.html +118 -0
- package/coverage/lcov-report/webpack/index.html +116 -0
- package/coverage/lcov-report/webpack/runtime/define property getters.html +118 -0
- package/coverage/lcov-report/webpack/runtime/global.html +118 -0
- package/coverage/lcov-report/webpack/runtime/hasOwnProperty shorthand.html +118 -0
- package/coverage/lcov-report/webpack/runtime/index.html +161 -0
- package/coverage/lcov-report/webpack/runtime/make namespace object.html +118 -0
- package/coverage/lcov.info +46329 -0
- package/dist/src/ox-input-file.d.ts +42 -0
- package/dist/src/ox-input-file.js +271 -38
- package/dist/src/ox-input-file.js.map +1 -1
- package/dist/test/ox-input-file.test.d.ts +1 -0
- package/dist/test/ox-input-file.test.js +103 -0
- package/dist/test/ox-input-file.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/test/ox-input-file.test.ts +136 -0
- package/translations/en.json +9 -0
- package/translations/es.json +9 -0
- package/translations/ja.json +9 -0
- package/translations/ko.json +9 -0
- package/translations/ms.json +9 -0
- package/translations/zh.json +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-input-file.test.js","sourceRoot":"","sources":["../../test/ox-input-file.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,IAAI,E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AAC,CAAC,CAAA;QAC1C,MAAM,MAAM,CAAC,EAAE,CAAC,CAAA;QAChB,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;QACjD,MAAM,EAAE,GAAQ,MAAM,OAAO,CAAC,IAAI,CAAA,iCAAiC,CAAC,CAAA;QAEpE,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC9D,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAA;QAEvE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;QAC3B,MAAM,MAAM,CAAC,EAAE,CAAC,CAAA;QAChB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACjE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { aTimeout, expect, fixture } from '@open-wc/testing'\nimport { html } from 'lit'\n\nimport { registerFileUploadLimits } from '@operato/utils'\n\nimport '../src/ox-input-file.js'\n\n/**\n * The one file picker.\n *\n * ## Why this is tested\n *\n * Every screen that takes a file goes through this element, and a 360 uses its quiet look. What\n * must hold:\n *\n * ```\n * quiet no box: an attach button; once picked, the name with replace and remove\n * refusal a type outside accept or a file over the server's limit never becomes the value,\n * and says so in place — a drop skips the native accept filter\n * drop target a drop lands on the element the owner gives (a 360 section), and only there\n * progress while the owner uploads, the buttons wait and the percent shows\n * ```\n */\ndescribe('ox-input-file', () => {\n const file = (name: string, type: string, size = 10) => new File([new Uint8Array(size)], name, { type })\n\n const drop = (area: HTMLElement, ...files: File[]) => {\n const dataTransfer = new DataTransfer()\n files.forEach(one => dataTransfer.items.add(one))\n area.dispatchEvent(new DragEvent('drop', { dataTransfer, bubbles: true, cancelable: true }))\n }\n\n const settle = async (el: any) => {\n await aTimeout(0)\n await el.updateComplete\n }\n\n const buttons = (el: any) => [...el.renderRoot.querySelectorAll('button')] as HTMLButtonElement[]\n\n /* The theme token the box border is drawn with; without it the border falls away and every look reads 'none'. */\n before(() => document.documentElement.style.setProperty('--md-sys-color-outline-variant', 'gray'))\n after(() => document.documentElement.style.removeProperty('--md-sys-color-outline-variant'))\n\n afterEach(() => registerFileUploadLimits(async () => ({})))\n\n it('draws no box when quiet, and shows the picked name with replace and remove', async () => {\n const el: any = await fixture(html`<ox-input-file quiet accept=\"image/*,application/pdf\"></ox-input-file>`)\n\n expect(getComputedStyle(el).borderTopStyle, 'quiet still draws a box').to.equal('none')\n expect(buttons(el).length, 'one attach button before a pick').to.equal(1)\n\n let changes = 0\n el.addEventListener('change', () => changes++)\n\n drop(el, file('paper.pdf', 'application/pdf'))\n await settle(el)\n\n expect(el.value.map((one: File) => one.name)).to.deep.equal(['paper.pdf'])\n expect(el.renderRoot.querySelector('.picked .name').textContent).to.equal('paper.pdf')\n expect(buttons(el).length, 'replace and remove').to.equal(2)\n\n const remove = buttons(el).find(one => one.hasAttribute('danger'))!\n remove.click()\n await el.updateComplete\n\n expect(el.value).to.deep.equal([])\n expect(changes).to.equal(2)\n })\n\n it('refuses a type outside accept and a file over the server limit, in place', async () => {\n registerFileUploadLimits(async () => ({ maxFileSize: 20 }))\n\n const el: any = await fixture(html`<ox-input-file quiet multiple accept=\"image/*\"></ox-input-file>`)\n\n drop(el, file('note.txt', 'text/plain'), file('big.png', 'image/png', 50), file('ok.png', 'image/png', 5))\n await settle(el)\n\n expect(el.value.map((one: File) => one.name)).to.deep.equal(['ok.png'])\n\n const refusal = el.renderRoot.querySelector('[role=\"alert\"]')\n expect(refusal, 'no refusal shown').to.exist\n expect(refusal.textContent).to.contain('note.txt')\n expect(refusal.textContent).to.contain('big.png')\n })\n\n it('takes a drop on the given target and lets go of the old one', async () => {\n const section = document.createElement('section')\n const other = document.createElement('section')\n document.body.append(section, other)\n\n const el: any = await fixture(html`<ox-input-file quiet .dropTarget=${section}></ox-input-file>`)\n\n drop(section, file('a.pdf', 'application/pdf'))\n await settle(el)\n expect(el.value.map((one: File) => one.name)).to.deep.equal(['a.pdf'])\n\n el.dropTarget = other\n await el.updateComplete\n\n drop(section, file('b.pdf', 'application/pdf'))\n await settle(el)\n expect(el.value.map((one: File) => one.name), 'the old target still takes drops').to.deep.equal(['a.pdf'])\n\n section.dispatchEvent(new DragEvent('dragenter', { bubbles: true }))\n expect(section.classList.contains('candrop'), 'the old target still lights up').to.equal(false)\n\n drop(other, file('c.pdf', 'application/pdf'))\n await settle(el)\n expect(el.value.map((one: File) => one.name)).to.deep.equal(['c.pdf'])\n\n section.remove()\n other.remove()\n })\n\n it('waits while the owner uploads and shows the percent', async () => {\n const el: any = await fixture(html`<ox-input-file quiet .progress=${0.4}></ox-input-file>`)\n\n expect(buttons(el).every(one => one.disabled), 'a button works mid-upload').to.equal(true)\n expect(el.renderRoot.querySelector('[role=\"status\"]').textContent).to.contain('40')\n\n drop(el, file('a.pdf', 'application/pdf'))\n await settle(el)\n expect(el.value ?? [], 'a drop landed mid-upload').to.deep.equal([])\n })\n\n it('keeps the drop box when not quiet', async () => {\n const el: any = await fixture(html`<ox-input-file></ox-input-file>`)\n\n expect(getComputedStyle(el).borderTopStyle).to.equal('dashed')\n expect(el.renderRoot.querySelector('label[for=\"input-file\"]')).to.exist\n\n drop(el, file('a.bin', ''))\n await settle(el)\n expect(el.renderRoot.querySelectorAll('li').length).to.equal(1)\n })\n})\n"]}
|