-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add feature-flag for code-submode playground panel
- Loading branch information
1 parent
3920809
commit c8abd0f
Showing
4 changed files
with
139 additions
and
3 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
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
105 changes: 105 additions & 0 deletions
105
packages/host/tests/acceptance/code-submode/playground-test.gts
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,105 @@ | ||
import { waitFor } from '@ember/test-helpers'; | ||
import { module, test } from 'qunit'; | ||
import { | ||
setupAcceptanceTestRealm, | ||
setupLocalIndexing, | ||
setupServerSentEvents, | ||
testRealmURL, | ||
visitOperatorMode, | ||
} from '../../helpers'; | ||
import { setupMockMatrix } from '../../helpers/mock-matrix'; | ||
import { setupApplicationTest } from '../../helpers/setup'; | ||
|
||
module('Integration | code-submode | playground panel', function (hooks) { | ||
setupApplicationTest(hooks); | ||
setupLocalIndexing(hooks); | ||
setupServerSentEvents(hooks); | ||
setupMockMatrix(hooks, { | ||
loggedInAs: '@testuser:staging', | ||
activeRealms: [testRealmURL], | ||
}); | ||
|
||
const authorCard = ` | ||
import { contains, field, CardDef } from "https://cardstack.com/base/card-api"; | ||
import MarkdownField from 'https://cardstack.com/base/markdown'; | ||
import StringField from "https://cardstack.com/base/string"; | ||
export class Author extends CardDef { | ||
static displayName = 'Author'; | ||
@field firstName = contains(StringField); | ||
@field lastName = contains(StringField); | ||
@field bio = contains(MarkdownField); | ||
@field title = contains(StringField, { | ||
computeVia: function (this: Person) { | ||
return [this.firstName, this.lastName].filter(Boolean).join(' '); | ||
}, | ||
}); | ||
} | ||
`; | ||
const blogPostCard = ` | ||
import { contains, field, linksTo, CardDef } from "https://cardstack.com/base/card-api"; | ||
import DatetimeField from 'https://cardstack.com/base/datetime'; | ||
import MarkdownField from 'https://cardstack.com/base/markdown'; | ||
import StringField from "https://cardstack.com/base/string"; | ||
import { Author } from './author'; | ||
export class BlogPost extends CardDef { | ||
static displayName = 'Blog Post'; | ||
@field publishDate = contains(DatetimeField); | ||
@field author = linksTo(Author); | ||
@field body = contains(MarkdownField); | ||
} | ||
`; | ||
|
||
hooks.beforeEach(async function () { | ||
await setupAcceptanceTestRealm({ | ||
contents: { | ||
'author.gts': authorCard, | ||
'blog-post.gts': blogPostCard, | ||
'Author/jane-doe.json': { | ||
data: { | ||
attributes: { | ||
firstName: 'Jane', | ||
lastName: 'Doe', | ||
}, | ||
meta: { | ||
adoptsFrom: { | ||
module: `${testRealmURL}author`, | ||
name: 'Author', | ||
}, | ||
}, | ||
}, | ||
}, | ||
'BlogPost/remote-work.json': { | ||
data: { | ||
attributes: { | ||
title: 'The Ultimate Guide to Remote Work', | ||
description: | ||
'In today’s digital age, remote work has transformed from a luxury to a necessity. This comprehensive guide will help you navigate the world of remote work, offering tips, tools, and best practices for success.', | ||
}, | ||
relationships: { | ||
author: { | ||
links: { | ||
self: `${testRealmURL}Author/jane-doe`, | ||
}, | ||
}, | ||
}, | ||
meta: { | ||
adoptsFrom: { | ||
module: `${testRealmURL}blog-post`, | ||
name: 'BlogPost', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}); | ||
|
||
test('can render playground panel', async function (assert) { | ||
await visitOperatorMode({ | ||
submode: 'code', | ||
codePath: `${testRealmURL}blog-post.gts`, | ||
}); | ||
await waitFor('[data-test-accordion-item="playground"]'); | ||
assert.dom('[data-test-accordion-item="playground"]').exists(); | ||
}); | ||
}); |