Allow to customize Submit button label and tooltip
Ibe3547942 renamed "Submit" button to "Merge Change" with justification why to prefer "Merge Change" label over "Submit". I5d7e1d21a reverted that change and restored it back to "Submit" with another justification for why "Merge Change" can be misleading. This change externalize the label name and tooltip for Submit button to enable site administrator to customize it. Bug: issue 2667 Change-Id: Iec78b31051f6b0022af1f337f5d492b78c7df096
This commit is contained in:
		 David Ostrovsky
					David Ostrovsky
				
			
				
					committed by
					
						 Shawn Pearce
						Shawn Pearce
					
				
			
			
				
	
			
			
			 Shawn Pearce
						Shawn Pearce
					
				
			
						parent
						
							62804b2d1a
						
					
				
				
					commit
					9933eb35df
				
			| @@ -14,15 +14,17 @@ | ||||
|  | ||||
| package com.google.gerrit.common.data; | ||||
|  | ||||
| import static org.junit.Assert.assertEquals; | ||||
| import static org.junit.Assert.assertNotNull; | ||||
| import static org.junit.Assert.assertTrue; | ||||
|  | ||||
| import com.google.common.collect.ImmutableMap; | ||||
|  | ||||
| import org.junit.Test; | ||||
|  | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
|  | ||||
| import static org.junit.Assert.assertEquals; | ||||
| import static org.junit.Assert.assertNotNull; | ||||
| import static org.junit.Assert.assertTrue; | ||||
|  | ||||
| public class ParameterizedStringTest { | ||||
|   @Test | ||||
|   public void testEmptyString() { | ||||
| @@ -394,4 +396,32 @@ public class ParameterizedStringTest { | ||||
|     assertEquals("foo@example.com", p.bind(a)[0]); | ||||
|     assertEquals("foo@example.com", p.replace(a)); | ||||
|   } | ||||
|  | ||||
|   @Test | ||||
|   public void testReplaceSubmitTooltipWithVariables() { | ||||
|     ParameterizedString p = new ParameterizedString( | ||||
|         "Submit patch set ${patchSet} into ${branch}"); | ||||
|     assertEquals(2, p.getParameterNames().size()); | ||||
|     assertTrue(p.getParameterNames().contains("patchSet")); | ||||
|  | ||||
|     Map<String, String> params = ImmutableMap.of( | ||||
|         "patchSet", "42", | ||||
|         "branch", "foo"); | ||||
|     assertNotNull(p.bind(params)); | ||||
|     assertEquals(2, p.bind(params).length); | ||||
|     assertEquals("42", p.bind(params)[0]); | ||||
|     assertEquals("foo", p.bind(params)[1]); | ||||
|     assertEquals("Submit patch set 42 into foo", p.replace(params)); | ||||
|   } | ||||
|  | ||||
|   @Test | ||||
|   public void testReplaceSubmitTooltipWithoutVariables() { | ||||
|     ParameterizedString p = new ParameterizedString( | ||||
|             "Submit patch set 40 into master"); | ||||
|     Map<String, String> params = ImmutableMap.of( | ||||
|         "patchSet", "42", | ||||
|         "branch", "foo"); | ||||
|     assertEquals(0, p.bind(params).length); | ||||
|     assertEquals("Submit patch set 40 into master", p.replace(params)); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user