Experiment: QUnit for integration Ember integration tests
This commit is contained in:
parent
8c888f424b
commit
a104c37d63
1
Gemfile
1
Gemfile
|
@ -100,6 +100,7 @@ group :test, :development do
|
||||||
gem 'guard-jshint-on-rails', require: false
|
gem 'guard-jshint-on-rails', require: false
|
||||||
gem 'certified', require: false
|
gem 'certified', require: false
|
||||||
gem 'fabrication', require: false
|
gem 'fabrication', require: false
|
||||||
|
gem 'qunit-rails'
|
||||||
gem 'guard-jasmine', require: false
|
gem 'guard-jasmine', require: false
|
||||||
gem 'guard-rspec', require: false
|
gem 'guard-rspec', require: false
|
||||||
gem 'guard-spork', require: false
|
gem 'guard-spork', require: false
|
||||||
|
|
|
@ -317,6 +317,8 @@ GEM
|
||||||
pry (~> 0.9.10)
|
pry (~> 0.9.10)
|
||||||
pry-rails (0.2.2)
|
pry-rails (0.2.2)
|
||||||
pry (>= 0.9.10)
|
pry (>= 0.9.10)
|
||||||
|
qunit-rails (0.0.3)
|
||||||
|
railties (>= 3.2.3)
|
||||||
rack (1.4.5)
|
rack (1.4.5)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
|
@ -531,6 +533,7 @@ DEPENDENCIES
|
||||||
pg
|
pg
|
||||||
pry-nav
|
pry-nav
|
||||||
pry-rails
|
pry-rails
|
||||||
|
qunit-rails
|
||||||
rack-cache
|
rack-cache
|
||||||
rack-cors
|
rack-cors
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
|
|
|
@ -15,6 +15,7 @@ Discourse.ListController = Discourse.Controller.extend({
|
||||||
availableNavItems: function() {
|
availableNavItems: function() {
|
||||||
var summary = this.get('filterSummary');
|
var summary = this.get('filterSummary');
|
||||||
var loggedOn = !!Discourse.User.current();
|
var loggedOn = !!Discourse.User.current();
|
||||||
|
|
||||||
return Discourse.SiteSettings.top_menu.split("|").map(function(i) {
|
return Discourse.SiteSettings.top_menu.split("|").map(function(i) {
|
||||||
return Discourse.NavItem.fromText(i, {
|
return Discourse.NavItem.fromText(i, {
|
||||||
loggedOn: loggedOn
|
loggedOn: loggedOn
|
||||||
|
|
|
@ -30,7 +30,8 @@ Discourse.Route.buildRoutes(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// the homepage is the first item of the 'top_menu' site setting
|
// the homepage is the first item of the 'top_menu' site setting
|
||||||
var homepage = PreloadStore.get('siteSettings').top_menu.split("|")[0].split(",")[0];
|
var settings = Discourse.SiteSettings || PreloadStore.get('siteSettings')
|
||||||
|
var homepage = settings.top_menu.split("|")[0].split(",")[0];
|
||||||
this.route(homepage, { path: '/' });
|
this.route(homepage, { path: '/' });
|
||||||
|
|
||||||
this.route('categories', { path: '/categories' });
|
this.route('categories', { path: '/categories' });
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
module("Header", {
|
||||||
|
setup: function() {
|
||||||
|
Ember.run(Discourse, Discourse.advanceReadiness);
|
||||||
|
},
|
||||||
|
|
||||||
|
teardown: function() {
|
||||||
|
$('#discourse-modal').modal('hide')
|
||||||
|
$('#discourse-modal').remove()
|
||||||
|
Discourse.reset();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("/", function() {
|
||||||
|
expect(2);
|
||||||
|
|
||||||
|
visit("/").then(function() {
|
||||||
|
ok(exists("header"), "The header was rendered");
|
||||||
|
ok(exists("#site-logo"), "The logo was shown");
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
//= require env
|
||||||
|
|
||||||
|
//= require ../../app/assets/javascripts/preload_store.js
|
||||||
|
|
||||||
|
// probe framework first
|
||||||
|
//= require ../../app/assets/javascripts/discourse/components/probes.js
|
||||||
|
|
||||||
|
// Externals we need to load first
|
||||||
|
//= require ../../app/assets/javascripts/external/jquery-1.9.1.js
|
||||||
|
//= require ../../app/assets/javascripts/external/jquery.ui.widget.js
|
||||||
|
//= require ../../app/assets/javascripts/external/handlebars-1.0.rc.4.js
|
||||||
|
//= require ../../app/assets/javascripts/external_development/ember.js
|
||||||
|
//= require ../../app/assets/javascripts/external_development/group-helper.js
|
||||||
|
|
||||||
|
//= require ../../app/assets/javascripts/locales/i18n
|
||||||
|
//= require ../../app/assets/javascripts/locales/date_locales.js
|
||||||
|
//= require ../../app/assets/javascripts/discourse/helpers/i18n_helpers
|
||||||
|
//= require ../../app/assets/javascripts/locales/en
|
||||||
|
//
|
||||||
|
// Pagedown customizations
|
||||||
|
//= require ../../app/assets/javascripts/pagedown_custom.js
|
||||||
|
|
||||||
|
// The rest of the externals
|
||||||
|
//= require_tree ../../app/assets/javascripts/external
|
||||||
|
|
||||||
|
// Stuff we need to load first
|
||||||
|
//= require main_include
|
||||||
|
//= require admin
|
||||||
|
//= require_tree ../../app/assets/javascripts/defer
|
||||||
|
|
||||||
|
//= require main_include
|
||||||
|
//= require_tree .
|
||||||
|
//= require_self
|
||||||
|
|
||||||
|
document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>');
|
||||||
|
document.write('<style>#ember-testing-container { position: absolute; background: white; bottom: 0; right: 0; width: 640px; height: 384px; overflow: auto; z-index: 9999; border: 1px solid #ccc; } #ember-testing { zoom: 50%; }</style>');
|
||||||
|
|
||||||
|
Discourse.rootElement = '#ember-testing';
|
||||||
|
Discourse.setupForTesting();
|
||||||
|
Discourse.injectTestHelpers();
|
||||||
|
|
||||||
|
|
||||||
|
Discourse.SiteSettings = {"title":"Discourse Meta","logo_url":"/assets/logo.png","logo_small_url":"/assets/logo-single.png","traditional_markdown_linebreaks":false,"top_menu":"latest|new|unread|read|favorited|categories","post_menu":"like|edit|flag|delete|share|bookmark|reply","share_links":"twitter|facebook|google+|email","track_external_right_clicks":false,"must_approve_users":false,"ga_tracking_code":"UA-33736483-2","ga_domain_name":"","enable_long_polling":true,"polling_interval":3000,"anon_polling_interval":30000,"min_post_length":20,"max_post_length":16000,"min_topic_title_length":15,"max_topic_title_length":255,"min_private_message_title_length":2,"allow_uncategorized_topics":true,"min_search_term_length":3,"flush_timings_secs":5,"supress_reply_directly_below":true,"email_domains_blacklist":"mailinator.com","email_domains_whitelist":null,"version_checks":true,"min_title_similar_length":10,"min_body_similar_length":15,"category_colors":"BF1E2E|F1592A|F7941D|9EB83B|3AB54A|12A89D|25AAE2|0E76BD|652D90|92278F|ED207B|8C6238|231F20|808281|B3B5B4|283890","max_upload_size_kb":1024,"category_featured_topics":6,"favicon_url":"/assets/favicon.ico","dynamic_favicon":false,"uncategorized_name":"uncategorized","uncategorized_color":"AB9364","uncategorized_text_color":"FFFFFF","invite_only":false,"login_required":false,"enable_local_logins":true,"enable_local_account_create":true,"enable_google_logins":true,"enable_yahoo_logins":true,"enable_twitter_logins":true,"enable_facebook_logins":true,"enable_cas_logins":false,"enable_github_logins":true,"enable_persona_logins":true,"educate_until_posts":2,"topic_views_heat_low":1000,"topic_views_heat_medium":2000,"topic_views_heat_high":5000};
|
||||||
|
|
||||||
|
Discourse.Router.map(function() {
|
||||||
|
return Discourse.routeBuilder.call(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
function exists(selector) {
|
||||||
|
return !!find(selector).length;
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
/*
|
||||||
|
*= require application
|
||||||
|
*= require_tree .
|
||||||
|
*/
|
Loading…
Reference in New Issue