瀏覽代碼

update: condition based class and tests updated

Arup3201 2 周之前
父節點
當前提交
39855915f1
共有 2 個文件被更改,包括 4 次插入5 次删除
  1. 2 2
      src/plugins/controlbox/templates/loginform.js
  2. 2 3
      src/plugins/controlbox/tests/login.js

+ 2 - 2
src/plugins/controlbox/templates/loginform.js

@@ -88,7 +88,7 @@ function tplAuthFields() {
     return html`
         <div class="mb-3">
             <label for="converse-login-jid" class="form-label">${i18n_xmpp_address}:</label>
-            <div class="input-group">
+            <div class="${locked_domain ? 'input-group' : ''}">
                 <input
                     id="converse-login-jid"
                     ?autofocus=${api.settings.get('auto_focus') ? true : false}
@@ -101,7 +101,7 @@ function tplAuthFields() {
                 />
                 ${locked_domain ? tplDomain(locked_domain) : ''}
             </div>
-	</div>
+        </div>
         ${authentication !== EXTERNAL ? tplPasswordInput() : ''}
         ${api.settings.get('show_connection_url_input') ? tplConnectionURLInput() : ''}
         ${show_trust_checkbox ? tplTrustCheckbox(show_trust_checkbox === 'off' ? false : true) : ''}

+ 2 - 3
src/plugins/controlbox/tests/login.js

@@ -4,7 +4,7 @@ const u = converse.env.utils;
 
 describe("The Login Form", function () {
     
-    it("contains an addon when locked_domain is set", 
+    it("shows the domain name when locked_domain is set", 
         mock.initConverse(
             ['chatBoxesInitialized'], 
             { auto_login: false, 
@@ -19,8 +19,7 @@ describe("The Login Form", function () {
         const addons = cbview.querySelectorAll('div.input-group');
         expect(addons.length).toBe(1);
         
-        const addon = addons[0];
-        expect(addon.innerHTML, 'jabber.hot-chilli.eu');
+        expect(cbview.querySelector('div.input-group').textContent, 'jabber.hot-chilli.eu');
     }))
 
     it("contains a checkbox to indicate whether the computer is trusted or not",