ember-cli-mirage

Where did my data get stuck in Ember? <!---->

大城市里の小女人 提交于 2020-01-05 10:08:21
问题 I'm trying to learn ember but having a hard time finding out why my data from the backend is not showing up. I'm using Ember Data with mirage fixtures. The data is showing up. Only if I introduce simple relationships the data from those relationships is not showing up in my app. Is there a general way how to debug when you just get <!----> in your ember app? mirage/fixtures/contacts.js export default [ { id: 1, userName: "Barack Obama", profilePictureUrl: "/img/profilepics/barack.png",

Introduce momentary delays in ember-cli-mirage

纵饮孤独 提交于 2020-01-03 03:30:30
问题 I am using ember-cli-mirage for acceptance tests. For a specific case, I would like to check the behaviour while fetching data over a slow connection. There's a setting in ember-cli-mirage called timing that simulates a delay in the response. However, this setting cannot be changed to be different in a specific test: // app/mirage/config.js this.timing = 400; Something else I have tried is returning a promise at the fake endpoint. Through some import/export, I could control the resolution of

Place to put assets for dev/test in emberjs

霸气de小男生 提交于 2019-12-24 08:25:42
问题 I'm using mirage to mock some data and I'd like to mock an <img> with the appropriate file. The problem is that I will have to place the image in /public/assets and the images placed there will be deployed later on as well. Is there a way to avoid this? I couldn't find a recommendation in the ember cli website (https://ember-cli.com/user-guide/#asset-compilation) I found one addon that could do this (ember-test-assets), but I'd like to avoid installing extra addons as much as possible. Thanks

Testing error responses with ember-cli-mirage

本小妞迷上赌 提交于 2019-12-24 01:54:23
问题 I'm reading through ember-cli-mirage's docs about creating mock responses but can't figure out how to test error responses for the exact same request. For example: test("I can view the users", function() { var users = server.createList('user', 3); visit('/users'); andThen(function() { equal( find('li').length, 3 ); equal( find('li:first').text(), users[0].name ); }); }); test("I can view the error if viewing the users returns an error", function() { // somehow set up an error response (?)

Ember tests/Mirage not finding DOM elements

孤街浪徒 提交于 2019-12-12 02:59:09
问题 I'm trying to do some basic acceptance tests in Ember, using Mirage. I'm using only fixtures at this point to populate the test environment, just to find my feet. When I run ember in the test environment (i.e., with -e test), I can see my app is populating with expected data. And the DOM has some buttons, etc. All is well. However, when I run a test to visit a page and click a button, the test is telling me it can't find the button. In other words, running -e test and checking localhost shows

relative image source ember js

我们两清 提交于 2019-12-11 05:38:14
问题 i have a problem with assets path in emberjs(ember-cli). I have 2 routes: index and article route, the path for index route is just a / and the path for the article route is article/:article_id router.js Router.map(function() { this.route('article', {path : '/article/:article_id'}); }); In the idnex template, i reference my assets that are in the directory public/assets/ with the following : <img src="/assets/images/image1.jpg/> and its work great, but when i use the same tag in the article