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

  • Home
  • SEARCH
  • 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 8282983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:34:24+00:00 2026-06-08T10:34:24+00:00

I have a BuildingBlocks view that has a template like this : {{#each controller}}

  • 0

I have a BuildingBlocks view that has a template like this :

{{#each controller}}
  {{view App.BuildingBlockView contentBinding="this"}}
{{/each}}

I am trying to test that this view loops over each post using the controller.
I am using Jasmine.

I have created the view like this

App.buildingBlocksView = App.BuildingBlocksView.create()
Em.run ->
  App.buildingBlocksView.append()

And i want to populate the controller for this view with 3 BuildingBlocks so i can test that this view contains 3 elements.

Please can anyone tell me how to do this ?

I am doing this so far but does not work.

App.buildingBlocksController = App.BuildingBlocksController.create()
App.buildingBlocksView.set("controller", App.buildingBlocksController.content)
App.buildingBlocksView.controller.pushObject(App.BuildingBlock.createRecord(), App.BuildingBlock.createRecord(), App.BuildingBlock.createRecord())
expect(App.buildingBlocksView.$('.building-block').length).toEqual(3)

But i am getting error Cannot call method ‘pushObject’ of undefined

Please help
Rick

  • 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-08T10:34:26+00:00Added an answer on June 8, 2026 at 10:34 am

    Looks like you are on the right track – props for using jasmine.

    First, I don’t see the the definition in your question so double check that App.BuildingBlocksController is a subclass of Ember.ArrayController

    Assuming that’s the case, you’ll want to set the initial content array when creating the instance. Then set controller property of the view to the controller instance, and push objects as before.

    App.buildingBlocksController = App.BuildingBlocksController.create({ content: [] })
    App.buildingBlocksView.set("controller", App.buildingBlocksController)    
    App.buildingBlocksView.controller.pushObject(App.BuildingBlock.createRecord(), App.BuildingBlock.createRecord(), App.BuildingBlock.createRecord())
    

    That should solve the problem you’re having with pushObject. I suspect you’ll need to move the above within the Ember.run() loop, otherwise expectation will fail since Ember will not have updated the DOM.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have been trying couple of hours now to make my iphone app universal. The
have a php code like this,going to convert it in to C#. function isValid($n){
Have some dates in my local Oracle 11g database that are in this format:
Have an app that can use tts to read text messages. It can also
Have a rails app that is supposed to display a list of products/managers. After
Have a (rather complex) app that works fine on iOS 4 but fails on
have a small javscript that users can include into their sites like so: <script
I'm writing an app that deals with Albums of pictures. I have the following
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=

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.