Repository: jhipster/generator-jhipster
Pull request #10820 (2019-11-23 08:36:52)

Remove bold from menu and restore browser height 1024 in Protractor t…
…ests

This is alternative fix for #10806, this reverts current fix #10815 as #10815 can be called a hack. This is mentioned also by this comment: https://github.com/jhipster/generator-jhipster/pull/10815#issuecomment-557417432

Idea for this PR is coming from https://github.com/jhipster/generator-jhipster/pull/10815#issuecomment-557600257

I changed default theme:
* removed bold from a:hover
* changed dropdown-item colors
* fixed bootstrap problems after previous changes

As I'm not familiar with colors then if someone can find better way or better colors to remove `bold` from `a:hover` then I'm more than happy if this PR will be closed and alternative solution will be accepted.

-   Please make sure the below checklist is followed for Pull Requests.

-   [x] [All continuous integration tests](https://github.com/jhipster/generator-jhipster/actions) are green
-   [ ] Tests are added where necessary
-   [ ] Documentation is added/updated where necessary
-   [ ] Coding Rules & Commit Guidelines as per our [CONTRIBUTING.md document](https://github.com/jhipster/generator-jhipster/blob/master/CONTRIBUTING.md) are followed

<!--
Please also reference the issue number in a commit message to [automatically close the related Github issue](https://help.github.com/articles/closing-issues-via-commit-messages/)

Note: It is also possible to add `[skip ci]` to your commit message to skip Travis tests
-->



Patch:
diff --git a/generators/cleanup.js b/generators/cleanup.js
index 691440720b..a805e32cc3 100644
--- a/generators/cleanup.js
+++ b/generators/cleanup.js
@@ -212,7 +212,4 @@ function cleanupOldServerFiles(generator, javaDir, testDir, mainResourceDir, tes
         generator.config.delete('blueprint');
         generator.config.delete('blueprintVersion');
     }
-    if (generator.isJhipsterVersionLessThan('6.5.2')) {
-        generator.removeFile(`${testDir}web/rest/ClientForwardControllerIT.java`);
-    }
 }
diff --git a/generators/client/templates/angular/src/main/webapp/content/scss/_bootstrap-variables.scss.ejs b/generators/client/templates/angular/src/main/webapp/content/scss/_bootstrap-variables.scss.ejs
index 8bebb8ccb1..f576c25b01 100644
--- a/generators/client/templates/angular/src/main/webapp/content/scss/_bootstrap-variables.scss.ejs
+++ b/generators/client/templates/angular/src/main/webapp/content/scss/_bootstrap-variables.scss.ejs
@@ -41,4 +41,7 @@ $body-bg: #e4e5e6;
 // Font, line-height, and color for body text, headings, and more.
 
 $font-size-base: 1rem;
+
+$dropdown-link-hover-color: white;
+$dropdown-link-hover-bg: #343a40;
 <%_ } _%>
diff --git a/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs b/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs
index 893d944abb..b1322e2ce5 100644
--- a/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs
+++ b/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs
@@ -33,10 +33,24 @@ h4 {
 
 <%_ if (clientTheme === 'none') { _%>
 /* Increase contrast of links to get 100% on Lighthouse Accessability Audit. Override this color if you want to change the link color, or use a Bootswatch theme */
-a, a:hover {
+a {
     color: #533f03;
     font-weight: bold;
 }
+
+a:hover {
+    color: #533f03;
+}
+
+/* override hover color for dropdown-item forced by bootstrap to all a:not([href]):not([tabindex]) elements in _reboot.scss */
+a:not([href]):not([tabindex]):hover.dropdown-item {
+    color: $dropdown-link-hover-color;
+}
+
+/* override .dropdown-item.active background-color on hover */
+.dropdown-item.active:hover {
+    background-color: mix($dropdown-link-hover-bg, $dropdown-link-active-bg, 50%);
+}
 <%_ } _%>
 
 a:hover {
diff --git a/generators/server/files.js b/generators/server/files.js
index 2cac1790aa..26db0912d6 100644
--- a/generators/server/files.js
+++ b/generators/server/files.js
@@ -1247,8 +1247,8 @@ const serverFiles = {
             path: SERVER_TEST_SRC_DIR,
             templates: [
                 {
-                    file: 'package/web/rest/ClientForwardControllerTest.java',
-                    renameTo: generator => `${generator.testDir}web/rest/ClientForwardControllerTest.java`
+                    file: 'package/web/rest/ClientForwardControllerIT.java',
+                    renameTo: generator => `${generator.testDir}web/rest/ClientForwardControllerIT.java`
                 }
             ]
         },
diff --git a/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs b/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs
index 02d9d91312..d646f3fd5b 100644
--- a/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs
+++ b/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs
@@ -217,8 +217,10 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
         <%_ } _%>
     <%_ } _%>
             .exceptionHandling()
-                .authenticationEntryPoint(problemSupport)
-                .accessDeniedHandler(problemSupport)
+    <%_ if (authenticationType !== 'oauth2') { _%>
+            .authenticationEntryPoint(problemSupport)
+    <%_ } _%>
+            .accessDeniedHandler(problemSupport)
     <%_ if (authenticationType === 'session') { _%>
         <%_ if (!skipUserManagement) { _%>
         .and()


Test patch:
diff --git a/generators/client/templates/angular/src/test/javascript/protractor.conf.js.ejs b/generators/client/templates/angular/src/test/javascript/protractor.conf.js.ejs
index 816033f5ed..c4fa8facf4 100644
--- a/generators/client/templates/angular/src/test/javascript/protractor.conf.js.ejs
+++ b/generators/client/templates/angular/src/test/javascript/protractor.conf.js.ejs
@@ -57,7 +57,7 @@ exports.config = {
     },
 
     onPrepare: function() {
-        browser.driver.manage().window().setSize(1280, 10240);
+        browser.driver.manage().window().setSize(1280, 1024);
         // Disable animations
         // @ts-ignore
         browser.executeScript('document.body.className += " notransition";');
diff --git a/generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerTest.java.ejs b/generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerIT.java.ejs
similarity index 73%
rename from generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerTest.java.ejs
rename to generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerIT.java.ejs
index e499650a8a..f99b19a1bb 100644
--- a/generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerTest.java.ejs
+++ b/generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerIT.java.ejs
@@ -18,8 +18,22 @@
 -%>
 package <%=packageName%>.web.rest;
 
+<%_ if (databaseType === 'cassandra') { _%>
+import <%= packageName %>.AbstractCassandraTest;
+<%_ } _%>
+<%_ if (cacheProvider === 'redis') { _%>
+import <%=packageName%>.RedisTestContainerExtension;
+<%_ } _%>
+import <%=packageName%>.<%= mainClass %>;
+<%_ if (authenticationType === 'oauth2') { _%>
+import <%=packageName%>.config.TestSecurityConfiguration;
+<%_ } _%>
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+<%_ if (cacheProvider === 'redis') { _%>
+import org.junit.jupiter.api.extension.ExtendWith;
+<%_ } _%>
+import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.http.MediaType;
 import org.springframework.test.web.servlet.MockMvc;
 import org.springframework.test.web.servlet.ResultActions;
@@ -33,9 +47,17 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 /**
- * Unit tests for the {@link ClientForwardController} REST controller.
+ * Integration tests for the {@link ClientForwardController} REST controller.
  */
-public class ClientForwardControllerTest {
+<%_ if (authenticationType === 'oauth2') { _%>
+@SpringBootTest(classes = {<%= mainClass %>.class, TestSecurityConfiguration.class})
+<%_ } else { _%>
+@SpringBootTest(classes = <%= mainClass %>.class)
+<%_ } _%>
+<%_ if (cacheProvider === 'redis') { _%>
+@ExtendWith(RedisTestContainerExtension.class)
+<%_ } _%>
+public class ClientForwardControllerIT <% if (databaseType === 'cassandra') { %>extends AbstractCassandraTest <% } %>{
 
     private MockMvc restMockMvc;