Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7732015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:37:34+00:00 2026-06-01T06:37:34+00:00

While running code in production, I don’t have to interact with the Ember.js runloop

  • 0

While running code in production, I don’t have to interact with the Ember.js runloop but in my tests, I sometimes have to call Enber.run.end() to make the tests pass. This might have knock on effects of making other tests fail.

For example, here is my spec_helper:

beforeEach ->
  $('#jasmine_content').append('<div id="fieldset"></div>')
  Ember.test = true
  Lead.run()

$ ->
  $('body').append($('<div id="jasmine_content"></div>'))

I am setting the Ember.test flag to true in the above code which I am not entirely sure what this does.

Lead.run() creates the Ember application:

window.Lead = Ember.Application.create
  Controllers: {Leads: {}}
  Models: {}
  Views: {}

  run: ->
    @initEvents()
    @.set('search', Lead.Controllers.UrlSearch.create())
    # etc.

In some tests, I find myself having to call ember.run.end() to ensure that items will be in the DOM etc.

describe 'Controllers', ->
  describe 'UrlSearch', ->
    it 'should append view', ->
      Ember.run.end() 
      expect($('#goButton').length).toEqual(1)

Ending the runloop from individual tests feels wrong.

Whenever I update my spec_helper to this:

beforeEach ->
  $('#jasmine_content').append('<div id="fieldset"></div>')
  Ember.test = true
  Lead.run()
  Ember.run.end()

I get error messages like:

Cannot perform operations on a Metamorph that is not in the DOM

or

Must have a current run loop.

Are there any guidance or best practices for negotiating the runloop from tests?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:37:35+00:00Added an answer on June 1, 2026 at 6:37 am

    You should take a look at the tests, for example each_test.js. As you can see, adding the view to DOM or manipulating properties of controllers, … is always done within Ember.run to assure all changes and view updates are flushed and the bindings are synced:

    Ember.run(function(){
      view.append();
      ...
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some debugging code that if executed while running with GBD attached should
While running the code I've included below I receive the error EntityCommandExecutionException was unhandled
While I am running this code it showing me a following error:- Column 'virtuemart_product_id'
While running a batch file in Windows XP I have found randomly occurring error
The offending block of code is below. The code almost always works, but sometimes
I'm writing some logging/auditing code that will be running in production (not just when
While running this code: NSData *archivedSavedData = [[NSData alloc] init]; archivedSavedData = [defaults objectForKey:@listOfAccessNumbers];
I have a GF3 server in production. Sometimes, it just stops responding. At least,
I am getting this error while running my code: Error using ==> mldivide Matrix
We just started using git for our production code, and we are running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.