You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2014/09/30 22:48:16 UTC
[10/35] Revert "AMBARI-7536. Create skeleton for UI unit tests.
(onechiporenko)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/7faca858/contrib/views/slider/src/main/resources/ui/config.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/config.js b/contrib/views/slider/src/main/resources/ui/config.js
index 6b8a243..4c6a023 100755
--- a/contrib/views/slider/src/main/resources/ui/config.js
+++ b/contrib/views/slider/src/main/resources/ui/config.js
@@ -24,8 +24,7 @@ exports.config = {
javascripts: {
joinTo: {
'javascripts/app.js': /^(app|envs\/development)/,
- 'javascripts/vendor.js': /^(vendor\/scripts\/(common|development)|vendor\\scripts\\(common|development))/,
- 'javascripts/test.js': /^test(\/|\\)(?!vendor)/
+ 'javascripts/vendor.js': /^(vendor\/scripts\/(common|development)|vendor\\scripts\\(common|development))/
},
order: {
before: [
http://git-wip-us.apache.org/repos/asf/ambari/blob/7faca858/contrib/views/slider/src/main/resources/ui/test/demo/demo_integration_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/demo/demo_integration_test.js b/contrib/views/slider/src/main/resources/ui/test/demo/demo_integration_test.js
new file mode 100755
index 0000000..08e3693
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/test/demo/demo_integration_test.js
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+test("/", function() {
+ visit("/").then(function() {
+ equal(find("h2").text(), "Welcome to Ember.js", "Application header is rendered");
+ equal(find("li").length, 3, "There are three items in the list");
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7faca858/contrib/views/slider/src/main/resources/ui/test/demo/demo_unit_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/demo/demo_unit_test.js b/contrib/views/slider/src/main/resources/ui/test/demo/demo_unit_test.js
new file mode 100755
index 0000000..84d2758
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/test/demo/demo_unit_test.js
@@ -0,0 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+test('this is always true', function() {
+ equal(1, 1, '1 is not 1... ooooh!');
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7faca858/contrib/views/slider/src/main/resources/ui/test/helpers.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/helpers.js b/contrib/views/slider/src/main/resources/ui/test/helpers.js
new file mode 100755
index 0000000..54c9edb
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/test/helpers.js
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require('initialize');
+
+document.write('<div id="ember-testing"></div>');
+App.rootElement = '#ember-testing';
+App.setupForTesting();
+App.injectTestHelpers();
+
+module('Integration tests', {
+ setup: function() {
+ Ember.run(App, App.advanceReadiness);
+ },
+
+ teardown: function() {
+ App.reset();
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7faca858/contrib/views/slider/src/main/resources/ui/test/models/slider_app_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/models/slider_app_test.js b/contrib/views/slider/src/main/resources/ui/test/models/slider_app_test.js
deleted file mode 100644
index e56bcc9..0000000
--- a/contrib/views/slider/src/main/resources/ui/test/models/slider_app_test.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-moduleForModel('sliderApp', 'App.SliderApp', {
-
- needs: [
- 'model:sliderAppType',
- 'model:sliderAppComponent',
- 'model:quickLink',
- 'model:sliderAppAlert',
- 'model:typedProperty'
- ],
-
- setup: function() {
- App.set('gangliaHost', null);
- },
-
- teardown: function() {
- App.set('gangliaHost', null);
- }
-
-});
-
-test('doNotShowComponentsAndAlerts', function () {
-
- var sliderApp = this.subject({name: 'p1', status: 'FROZEN'});
-
- equal(sliderApp.get('doNotShowComponentsAndAlerts'), true, 'Should be true if status is FROZEN');
-
- Em.run(function () {
- sliderApp.set('status', 'FAILED');
- });
- equal(sliderApp.get('doNotShowComponentsAndAlerts'), true, 'Should be true if status is FAILED');
-
-});
-
-
-test('showMetrics', function () {
-
- var sliderApp = this.subject({name: 'p1', configs: {}});
-
- Em.run(function() {
- App.set('gangliaHost', 'some_host');
- });
- equal(sliderApp.get('showMetrics'), true, 'should be true if App.gangliaHost is provided');
-
- Em.run(function() {
- App.set('gangliaHost', null);
- sliderApp.set('status', App.SliderApp.Status.running);
- });
- equal(sliderApp.get('showMetrics'), true, 'should be true if status is RUNNING');
-
-});
\ No newline at end of file