Procházet zdrojové kódy

AMBARI-18389 - Config compare shows incorrect value after enabling kerberos <fix1> (rzang)

Richard Zang před 9 roky
rodič
revize
863aed6316

+ 1 - 1
ambari-web/app/views/common/configs/widgets/plain_config_text_field.js

@@ -29,7 +29,7 @@ App.PlainConfigTextField = Ember.View.extend(App.SupportsDependentConfigs, App.W
   templateName: require('templates/common/configs/widgets/plain_config_text_field'),
   valueBinding: 'config.value',
   classNames: ['widget-config-plain-text-field'],
-  placeholderBinding: 'config.savedValue',
+  placeholderBinding: 'config.placeholder',
 
   disabled: Em.computed.not('config.isEditable'),
 

+ 38 - 0
ambari-web/test/models/configs/objects/service_config_property_test.js

@@ -188,6 +188,44 @@ describe('App.ServiceConfigProperty', function () {
 
   App.TestAliases.testAsComputedAnd(getProperty(), 'hideFinalIcon', ['!isFinal', 'isNotEditable']);
 
+  describe('#placeholder', function () {
+    it('should equal foo', function() {
+      serviceConfigProperty.set('isEditable', true);
+      var testCases = [
+        {
+          placeholderText: 'foo',
+          savedValue: ''
+        },
+        {
+          placeholderText: '',
+          savedValue: 'foo'
+        },
+        {
+          placeholderText: 'foo',
+          savedValue: 'bar'
+        }
+      ];
+      testCases.forEach(function (item) {
+        serviceConfigProperty.set('placeholderText', item.placeholderText);
+        serviceConfigProperty.set('savedValue', item.savedValue);
+        expect(serviceConfigProperty.get('placeholder')).to.equal('foo');
+      });
+    });
+    it('should equal null', function() {
+      serviceConfigProperty.set('isEditable', false);
+      var testCases = [
+        {
+          placeholderText: 'foo',
+          savedValue: 'bar'
+        }
+      ];
+      testCases.forEach(function (item) {
+        serviceConfigProperty.set('placeholderText', item.placeholderText);
+        serviceConfigProperty.set('savedValue', item.savedValue);
+        expect(serviceConfigProperty.get('placeholder')).to.equal(null);
+      });
+    });
+  });
   describe('#isPropertyOverridable', function () {
     overridableFalseData.forEach(function (item) {
       it('should be false', function () {