Skip to content

Commit

Permalink
AF Password|PR review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kum-sushil committed Jan 14, 2025
1 parent 85a3153 commit 2c4303c
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 25 deletions.
41 changes: 41 additions & 0 deletions bundles/af-core/.fbExcludeFilterFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2022 Adobe
~
~ Licensed 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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<FindBugsFilter>
<Match>
<Bug pattern="SE_BAD_FIELD" />
</Match>
<Match>
<Bug pattern="SE_NO_SERIALVERSIONID" />
</Match>
<Match>
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE" />
</Match>
<Match>
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" />
</Match>
<Match>
<Class name="com.adobe.cq.forms.core.components.internal.servlets.FormMetaDataDataSourceServlet" />
<Method name="getDataSourceResources" />
<Bug pattern="NP_NULL_ON_SOME_PATH_EXCEPTION" />
</Match>
<!-- The below exclude needs to be fixed -->
<Match>
<Class name="com.adobe.cq.forms.core.components.internal.models.v1.formsportal.LinkImpl" />
<Method name="getAssetPathWithQueryParams" />
<Bug pattern="WMI_WRONG_MAP_ITERATOR" />
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;

import com.adobe.cq.forms.core.Utils;
import com.adobe.cq.forms.core.components.datalayer.FormComponentData;
import com.adobe.cq.forms.core.components.internal.form.FormConstants;
import com.adobe.cq.forms.core.components.models.form.FieldType;
import com.adobe.cq.forms.core.components.models.form.Password;
import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;

import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
import org.mockito.Mockito;

@ExtendWith(AemContextExtension.class)
public class PasswordImplTest {
Expand All @@ -57,12 +58,12 @@ void setUp() {
}

@Test
void testExportedType() {
void testExportedType() throws Exception {
Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context);
assertEquals(FormConstants.RT_FD_FORM_PASSWORD_V1, password.getExportedType());
TextInput textInputMock = Mockito.mock(TextInput.class);
Mockito.when(textInputMock.getExportedType()).thenCallRealMethod();
assertEquals("", textInputMock.getExportedType());
Password passwordMock = Mockito.mock(Password.class);
Mockito.when(passwordMock.getExportedType()).thenCallRealMethod();
assertEquals("", passwordMock.getExportedType());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
cq:lastModified="{Date}2024-03-12T12:04:40.719+05:30"
cq:lastModifiedBy="admin"
cq:template="/conf/core-components-examples/settings/wcm/templates/content-page"
jcr:description="Text Input"
jcr:description="Password"
jcr:primaryType="cq:PageContent"
jcr:title="Password"
sling:resourceType="forms-components-examples/components/page"
Expand All @@ -25,7 +25,7 @@
jcr:lastModified="{Date}2024-03-12T11:09:55.804+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="core/wcm/components/text/v2/text"
sling:resourceType="core/wcm/components/password/v1/password"
text="&lt;h1>Password&lt;sub>v1&lt;/sub>&lt;/h1>&#xd;&#xa;"
textIsRich="true"/>
<text
Expand All @@ -35,8 +35,8 @@
jcr:lastModified="{Date}2020-07-15T13:25:39.729+02:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="core/wcm/components/text/v2/text"
text="&lt;p>A text input (text box) component allows a user to enter and edit a single or multiple lines of text, depending on the type attribute of the input element. The text input component can be placed within a form and is usually labeled with a helpful text that easily identifies its purpose.&lt;/p>&lt;p>These text input fields can be used in a variety of ways, such as for collecting information like names, email addresses, phone numbers, and other types of text data. Additionally, the text input component can have additional functionality, styling, and accessibility features that can make it more user-friendly, efficient and accessible.&lt;/p>"
sling:resourceType="core/wcm/components/password/v1/password"
text="&lt;p>The password component allows a user to enter password, depending on the type attribute of the input element. The password component can be placed within a form and is usually labeled with a helpful text that easily identifies its purpose.&lt;/p>&lt;p>These password fields can be used to get passwords as input in login and similar forms.&lt;/p>"
textIsRich="true"/>
<teaser
cq:styleIds="[1550165685463]"
Expand Down Expand Up @@ -80,13 +80,13 @@
jcr:lastModified="{Date}2019-05-22T11:26:32.604+03:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="core/wcm/components/text/v2/text"
sling:resourceType="core/wcm/components/password/v2/password"
text="&lt;p>The component, simply displaying placeholder data.&lt;/p>"
textIsRich="true"/>
<demo
jcr:created="{Date}2018-12-07T12:55:03.496+01:00"
jcr:created="{Date}2023-12-07T12:55:03.496+01:00"
jcr:createdBy="admin"
jcr:lastModified="{Date}2018-12-07T12:55:03.496+01:00"
jcr:lastModified="{Date}2023-12-07T12:55:03.496+01:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="forms-components-examples/components/demo">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ We support replace feature that allows replacing Password component to any of th
* Number Input
* Telephone Input
* Text Box
* Email Input
* Date Picker

## JavaScript Data Attribute Bindings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@
});
}

#togglePasswordType(){
const widget = this.getWidget();
if(widget.value){
const widget = this.getWidget();
if (widget.type === "password") {
widget.type = "text";
this.getEyeIcon().classList.add('open');
} else {
widget.type = "password";
this.getEyeIcon().classList.remove('open');
}
}
#togglePasswordType() {
const widget = this.getWidget();
if (widget.value) {
const widget = this.getWidget();
if (widget.type === "password") {
widget.type = "text";
this.getEyeIcon().classList.add('open');
} else {
widget.type = "password";
this.getEyeIcon().classList.remove('open');
}
}
}
}

FormView.Utils.setupField(({element, formContainer}) => {
Expand Down

0 comments on commit 2c4303c

Please sign in to comment.