Permalink
Browse files

First formFor test passing

  • Loading branch information...
1 parent 3fabd48 commit 9daf2e331ca3b0fa1f5f615948080d93a4c837c0 @bcardarella bcardarella committed Feb 9, 2013
View
@@ -1,4 +1,38 @@
-bin/*
-.bundle/*
-dist/*
-tmp/*
+*.bpkg
+*.gem
+*.rbc
+.DS_Store
+.bpm
+.bundle
+.config
+.github-upload-token
+.yardoc
+InstalledFiles
+_site
+_yardoc
+assets
+assets/bpm_libs.js
+assets/bpm_styles.css
+bin/
+coverage
+dist
+docs/build
+docs/node_modules
+lib/*/tests/all.js
+lib/*/tests/qunit*
+lib/bundler/man
+pkg
+rdoc
+spade-boot.js
+spec/reports
+test/tmp
+test/version_tmp
+test_*.html
+/tests/ember-tests.js
+tmp
+tmp*.gem
+tmp.bpm
+tmp.spade
+tests/source
+node_modules
+.vagrant
@@ -0,0 +1 @@
+require('ember-formBuilder/helpers/formFor');
@@ -0,0 +1,3 @@
+Ember.Handlebars.registerBoundHelper('formFor', function(object, options) {
+ return Ember.Handlebars.helpers.view.call(object, Ember.FormBuilder.Form, options);
+});
@@ -1,3 +0,0 @@
-function() {
-true
-}
@@ -1 +1,6 @@
-true
+Ember.FormBuilder = Ember.Namespace.create({
+ VERSION: '0.0.1'
+});
+
+require('ember-formBuilder/helpers');
+require('ember-formBuilder/views');
@@ -0,0 +1 @@
+require('ember-formBuilder/views/form');
@@ -0,0 +1,3 @@
+Ember.FormBuilder.Form = Ember.View.extend({
+ tagName: 'form'
+});
@@ -0,0 +1,43 @@
+var model, view;
+var templateFor = function(template) {
+ return Ember.Handlebars.compile(template);
+};
+var original_lookup = Ember.lookup, lookup;
+
+module('the formFor helper', {
+ setup: function() {
+ model = Ember.Object.create({
+ });
+ },
+ teardown: function() {
+ Ember.run(function() {
+ view.destroy();
+ view = null;
+ });
+ Ember.lookup = original_lookup;
+ }
+});
+
+var append = function(view) {
+ Ember.run(function() {
+ view.appendTo('#qunit-fixture');
+ });
+};
+
+var assertHTML = function(view, expectedHTML) {
+ var html = view.$().html();
+
+ // IE 8 (and prior?) add the \r\n
+ html = html.replace(/<script[^>]*><\/script>/ig, '').replace(/[\r\n]/g, '');
+
+ equal(html, expectedHTML);
+};
+
+test('renders a form element', function() {
+ view = Ember.View.create({
+ template: templateFor('{{#formFor model}}{{/formFor}}'),
+ model: model
+ });
+ append(view);
+ ok(view.$().find('form').get(0));
+});
@@ -0,0 +1,35 @@
+/*globals ENV QUnit EmberDev */
+
+(function() {
+ window.Ember = {
+ testing: true
+ };
+ window.ENV = window.ENV || {};
+
+ // Test for "hooks in ENV.EMBER_LOAD_HOOKS['hookName'] get executed"
+ ENV.EMBER_LOAD_HOOKS = ENV.EMBER_LOAD_HOOKS || {};
+ ENV.EMBER_LOAD_HOOKS.__before_ember_test_hook__ = ENV.EMBER_LOAD_HOOKS.__before_ember_test_hook__ || [];
+ ENV.__test_hook_count__ = 0;
+ ENV.EMBER_LOAD_HOOKS.__before_ember_test_hook__.push(function(object) {
+ ENV.__test_hook_count__ += object;
+ });
+
+ // Handle extending prototypes
+ QUnit.config.urlConfig.push('extendprototypes');
+
+ var extendPrototypes = QUnit.urlParams.extendprototypes;
+ ENV['EXTEND_PROTOTYPES'] = !!extendPrototypes;
+
+ // Don't worry about jQuery version
+ ENV['FORCE_JQUERY'] = true;
+
+ if (EmberDev.jsHint) {
+ // jsHint makes its own Object.create stub, we don't want to use this
+ ENV['STUB_OBJECT_CREATE'] = !Object.create;
+ }
+
+ EmberDev.distros = {
+ spade: 'ember-spade.js',
+ build: 'ember-formBuilder.js',
+ };
+})();

0 comments on commit 9daf2e3

Please sign in to comment.