Skip to content

Commit

Permalink
Merge branch 'master' into 1936-migrate-c-resizer
Browse files Browse the repository at this point in the history
  • Loading branch information
chan-j-d committed Oct 4, 2023
2 parents e148db6 + 93e850f commit e004231
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
14 changes: 6 additions & 8 deletions frontend/cypress/tests/chartView/chartView_zoomFeature.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ describe('range changes in chartview should reflect in zoom', () => {
.get('#summary-charts .summary-chart__ramp .ramp')
.first()
.click(120, 20)
.click(200, 20);
.click(185, 20);

cy.get('#tab-zoom')
.should('be.visible');

cy.get('#tab-zoom .ramp .ramp__slice')
.first()
.invoke('attr', 'title')
.should('eq', '[2020-10-01] [#1312] Conditional run for markbind to gh pages deployment (#1337): +1 -0 lines ');
.should('eq', '[2020-05-23] [#1241] Restore checked file types (#1256): +14 -1 lines ');
cy.get('#tab-zoom .ramp .ramp__slice')
.last()
.invoke('attr', 'title')
Expand All @@ -306,7 +306,7 @@ describe('range changes in chartview should reflect in zoom', () => {
cy.get('body').type(zoomKey, { release: false })
.get('#summary-charts .summary-chart__ramp .ramp')
.first()
.click(200, 20)
.click(185, 20)
.click(250, 20);

cy.get('#tab-zoom')
Expand All @@ -319,8 +319,7 @@ describe('range changes in chartview should reflect in zoom', () => {
cy.get('#tab-zoom .ramp .ramp__slice')
.last()
.invoke('attr', 'title')
.should('eq', '[2020-11-21] [#1345] Authorship: Add last modified '
+ 'date to each LoC if specified (#1348): +165 -76 lines ');
.should('eq', '[2020-09-27] Add optional check for quotes in diff file regex (#1330): +1 -1 lines ');
});

// Assumptions: Contributer 'jamessspanggg' is the first result,
Expand All @@ -334,7 +333,7 @@ describe('range changes in chartview should reflect in zoom', () => {
cy.get('body').type(zoomKey, { release: false })
.get('#summary-charts .summary-chart__ramp .ramp')
.first()
.click(200, 20)
.click(185, 20)
.click(225, 20);

cy.get('#tab-zoom')
Expand All @@ -351,7 +350,6 @@ describe('range changes in chartview should reflect in zoom', () => {
cy.get('#tab-zoom .ramp .ramp__slice')
.last()
.invoke('attr', 'title')
.should('eq', '[2020-11-21] [#1345] Authorship: Add last modified date '
+ 'to each LoC if specified (#1348): +165 -76 lines ');
.should('eq', '[2020-09-27] Add optional check for quotes in diff file regex (#1330): +1 -1 lines ');
});
});
11 changes: 11 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@fortawesome/free-solid-svg-icons": "^6.0.0",
"@fortawesome/vue-fontawesome": "^3.0.3",
"@types/minimatch": "^5.1.2",
"@types/seedrandom": "^3.0.5",
"core-js": "^3.6.5",
"highlight.js": "^10.5.0",
"jszip": "^3.5.0",
Expand Down
12 changes: 7 additions & 5 deletions frontend/src/components/c-segment-collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@
c-segment(v-bind:segment="segment", v-bind:path="path")
</template>

<script>
<script lang='ts'>
import { defineComponent } from 'vue';
import cSegment from './c-segment.vue';
import Segment from '../utils/segment';
export default {
export default defineComponent({
name: 'c-segment-collection',
components: {
cSegment,
},
props: {
segments: {
type: Array,
type: Array<Segment>,
required: true,
},
path: {
Expand All @@ -28,11 +30,11 @@ export default {
};
},
methods: {
visibilityChanged(isVisible) {
visibilityChanged(isVisible: boolean) {
if (isVisible) {
this.isRendered = true;
}
},
},
};
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function getRandomHex() {
return `#${Math.round(randomGenerator() * maxHexColorValue + 1).toString(16).padStart(6, '0')}`;
}

function rgb2lab(rgb) {
function rgb2lab(rgb: number[]) {
let r = rgb[0] / 255;
let g = rgb[1] / 255;
let b = rgb[2] / 255;
Expand All @@ -29,7 +29,7 @@ function rgb2lab(rgb) {

// this delta E (perceptual color distance) implementation taken from @antimatter15 from
// github: https://github.com/antimatter15/rgb-lab
function deltaE(rgbA, rgbB) {
function deltaE(rgbA: number[], rgbB: number[]) {
const labA = rgb2lab(rgbA);
const labB = rgb2lab(rgbB);
const deltaL = labA[0] - labB[0];
Expand All @@ -49,7 +49,7 @@ function deltaE(rgbA, rgbB) {
return distance < 0 ? 0 : Math.sqrt(distance);
}

function hasSimilarExistingColors(existingColors, newHex) {
function hasSimilarExistingColors(existingColors: string[], newHex: string) {
const deltaEThreshold = 11;
// the lower limit of delta E to be similar, more info at http://zschuessler.github.io/DeltaE/learn/
return existingColors.some((existingHex) => {
Expand All @@ -59,7 +59,7 @@ function hasSimilarExistingColors(existingColors, newHex) {
});
}

function getNonRepeatingColor(existingColors) {
function getNonRepeatingColor(existingColors: string[]) {
let generatedHex = getRandomHex();
while (hasSimilarExistingColors(existingColors, generatedHex)) {
generatedHex = getRandomHex();
Expand Down

0 comments on commit e004231

Please sign in to comment.