-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
135 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<main> | ||
<div> | ||
<div class="prompt-card json"> | ||
<div> | ||
<div>Json</div> | ||
<div>https://www.adobe.com/dc-shared/promptcard.json</div> | ||
</div> | ||
<div> | ||
<div>Page</div> | ||
<div>B</div> | ||
</div> | ||
<div> | ||
<div>Prefix</div> | ||
<div>Analyze</div> | ||
</div> | ||
</div> | ||
<div class="section-metadata"> | ||
<div> | ||
<div>style</div> | ||
<div>Four up, xl-spacing</div> | ||
</div> | ||
<div> | ||
<div>background</div> | ||
<div>#f8f8f8</div> | ||
</div> | ||
</div> | ||
</div> | ||
</main> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"total": 2, | ||
"offset": 0, | ||
"limit": 2, | ||
"data": [ | ||
{ "page": "A", "prefix": "Ask", "title": "Sum it up", "prompt": "Summarize this document in 3 sentences."}, | ||
{ "page": "A", "prefix": "Ask", "title": "Sum it up", "prompt": "Summarize this document in 3 sentences."}, | ||
{ "page": "A", "prefix": "Ask", "title": "Sum it up", "prompt": "Summarize this document in 3 sentences."}, | ||
{ "page": "B", "prefix": "Analyze", "title": "Sum it up", "prompt": "Summarize this document in 3 sentences."}, | ||
{ "page": "B", "prefix": "Ask", "title": "Sum it up", "prompt": "Summarize this document in 3 sentences."}, | ||
{ "page": "B", "prefix": "Analyze", "title": "Sum it up", "prompt": "Summarize this document in 3 sentences."} | ||
], | ||
":type": "sheet" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable compat/compat */ | ||
import { readFile } from '@web/test-runner-commands'; | ||
import { expect } from '@esm-bundle/chai'; | ||
import sinon from 'sinon'; | ||
import { delay } from '../../helpers/waitfor.js'; | ||
|
||
describe('prompt-cards using json feature', () => { | ||
before(async () => { | ||
sinon.stub(window, 'fetch'); | ||
const res = new window.Response('Not Found', { status: 404 }); | ||
window.fetch.returns(Promise.resolve(res)); | ||
document.head.innerHTML = await readFile({ path: './mocks/head.html' }); | ||
document.body.innerHTML = await readFile({ path: './mocks/body-json.html' }); | ||
await import('../../../acrobat/scripts/scripts.js'); | ||
await delay(500); | ||
}); | ||
|
||
after(() => { | ||
sinon.restore(); | ||
}); | ||
|
||
it('shows no prompt card', async () => { | ||
const promptcard = document.querySelector('.prompt-card'); | ||
expect(promptcard).to.not.exist; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* eslint-disable compat/compat */ | ||
import { readFile } from '@web/test-runner-commands'; | ||
import { expect } from '@esm-bundle/chai'; | ||
import sinon from 'sinon'; | ||
import { waitForElement } from '../../helpers/waitfor.js'; | ||
|
||
describe('prompt-cards using json feature', () => { | ||
before(async () => { | ||
const promptcards = await readFile({ path: './mocks/promptcards.json' }); | ||
sinon.stub(window, 'fetch'); | ||
const res = new window.Response(promptcards, { status: 200 }); | ||
window.fetch.returns(Promise.resolve(res)); | ||
document.head.innerHTML = await readFile({ path: './mocks/head.html' }); | ||
document.body.innerHTML = await readFile({ path: './mocks/body-json.html' }); | ||
await import('../../../acrobat/scripts/scripts.js'); | ||
await waitForElement('.prompt-blade'); | ||
}); | ||
|
||
after(() => { | ||
sinon.restore(); | ||
}); | ||
|
||
it('creates prompt cards', async () => { | ||
const blades = document.querySelectorAll('.prompt-blade'); | ||
expect([...blades].length).to.equal(2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters