Repository: ambari Updated Branches: refs/heads/trunk 59284b48b -> f10eb9182
http://git-wip-us.apache.org/repos/asf/ambari/blob/f10eb918/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 4c6a023..6b8a243 100755 --- a/contrib/views/slider/src/main/resources/ui/config.js +++ b/contrib/views/slider/src/main/resources/ui/config.js @@ -24,7 +24,8 @@ exports.config = { javascripts: { joinTo: { 'javascripts/app.js': /^(app|envs\/development)/, - 'javascripts/vendor.js': /^(vendor\/scripts\/(common|development)|vendor\\scripts\\(common|development))/ + 'javascripts/vendor.js': /^(vendor\/scripts\/(common|development)|vendor\\scripts\\(common|development))/, + 'javascripts/test.js': /^test(\/|\\)(?!vendor)/ }, order: { before: [ http://git-wip-us.apache.org/repos/asf/ambari/blob/f10eb918/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 deleted file mode 100755 index 08e3693..0000000 --- a/contrib/views/slider/src/main/resources/ui/test/demo/demo_integration_test.js +++ /dev/null @@ -1,24 +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. - */ - -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/f10eb918/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 deleted file mode 100755 index 84d2758..0000000 --- a/contrib/views/slider/src/main/resources/ui/test/demo/demo_unit_test.js +++ /dev/null @@ -1,21 +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. - */ - -test('this is always true', function() { - equal(1, 1, '1 is not 1... ooooh!'); -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/f10eb918/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 deleted file mode 100755 index 54c9edb..0000000 --- a/contrib/views/slider/src/main/resources/ui/test/helpers.js +++ /dev/null @@ -1,34 +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. - */ - -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/f10eb918/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 new file mode 100644 index 0000000..e56bcc9 --- /dev/null +++ b/contrib/views/slider/src/main/resources/ui/test/models/slider_app_test.js @@ -0,0 +1,68 @@ +/** + * 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