mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-24 16:00:11 -04:00
two bug fixes for card rendering
clean up karma log more ui tests for the reducer
This commit is contained in:
parent
5ca59a0879
commit
c34fc69aaf
@ -3,30 +3,30 @@
|
|||||||
|
|
||||||
module.exports = function (config) {
|
module.exports = function (config) {
|
||||||
config.set({
|
config.set({
|
||||||
basePath: '',
|
basePath: "",
|
||||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
frameworks: ["jasmine", "@angular-devkit/build-angular"],
|
||||||
plugins: [
|
plugins: [
|
||||||
require('karma-jasmine'),
|
require("karma-jasmine"),
|
||||||
require('karma-chrome-launcher'),
|
require("karma-chrome-launcher"),
|
||||||
require('karma-jasmine-html-reporter'),
|
require("karma-jasmine-html-reporter"),
|
||||||
require('karma-coverage-istanbul-reporter'),
|
require("karma-coverage-istanbul-reporter"),
|
||||||
require('@angular-devkit/build-angular/plugins/karma')
|
require("@angular-devkit/build-angular/plugins/karma"),
|
||||||
],
|
],
|
||||||
client: {
|
client: {
|
||||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
clearContext: false, // leave Jasmine Spec Runner output visible in browser
|
||||||
},
|
},
|
||||||
coverageIstanbulReporter: {
|
coverageIstanbulReporter: {
|
||||||
dir: require('path').join(__dirname, './coverage/db'),
|
dir: require("path").join(__dirname, "./coverage/db"),
|
||||||
reports: ['html', 'lcovonly', 'text-summary'],
|
reports: ["html", "lcovonly", "text-summary"],
|
||||||
fixWebpackSourcePaths: true
|
fixWebpackSourcePaths: true,
|
||||||
},
|
},
|
||||||
reporters: ['progress', 'kjhtml'],
|
reporters: ["progress", "kjhtml"],
|
||||||
port: 9876,
|
port: 9876,
|
||||||
colors: true,
|
colors: true,
|
||||||
logLevel: config.LOG_INFO,
|
logLevel: config.LOG_WARN,
|
||||||
autoWatch: true,
|
autoWatch: true,
|
||||||
browsers: ['Chrome'],
|
browsers: ["Chrome"],
|
||||||
singleRun: false,
|
singleRun: false,
|
||||||
restartOnFileChange: true
|
restartOnFileChange: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -26,8 +26,7 @@
|
|||||||
|
|
||||||
<p
|
<p
|
||||||
[ngClass]="{
|
[ngClass]="{
|
||||||
'as-inline':
|
'as-inline': (showParagraphs$ | async) === false
|
||||||
(showParagraphs$ | async) === (false | null | undefined)
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<ng-container *ngFor="let vs of para.vss">
|
<ng-container *ngFor="let vs of para.vss">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, ElementRef, ViewChild } from '@angular/core';
|
import { Component, ElementRef, ViewChild, OnInit } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { AppService } from '../../../../services/app.service';
|
import { AppService } from '../../../../services/app.service';
|
||||||
import { CardComponent } from '../../../../common/components/card.component';
|
import { CardComponent } from '../../../../common/components/card.component';
|
||||||
@ -11,7 +11,7 @@ import { StrongsModalComponent } from '../modal/strongs-modal.component';
|
|||||||
styleUrls: ['./strongs-card.component.scss'],
|
styleUrls: ['./strongs-card.component.scss'],
|
||||||
preserveWhitespaces: true,
|
preserveWhitespaces: true,
|
||||||
})
|
})
|
||||||
export class StrongsCardComponent extends CardComponent {
|
export class StrongsCardComponent extends CardComponent implements OnInit {
|
||||||
asModal = false;
|
asModal = false;
|
||||||
@ViewChild('strongs') strongsElement: ElementRef;
|
@ViewChild('strongs') strongsElement: ElementRef;
|
||||||
|
|
||||||
@ -24,6 +24,9 @@ export class StrongsCardComponent extends CardComponent {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
ngOnInit(): void {
|
||||||
|
console.log(this.cardItem);
|
||||||
|
}
|
||||||
|
|
||||||
copy() {
|
copy() {
|
||||||
const html = this.strongsElement.nativeElement.innerHTML;
|
const html = this.strongsElement.nativeElement.innerHTML;
|
||||||
|
@ -2,7 +2,8 @@ import { TestBed } from '@angular/core/testing';
|
|||||||
import { reducer } from './app-state-reducer';
|
import { reducer } from './app-state-reducer';
|
||||||
import { AppAction, AppActionFactory } from './app-state-actions';
|
import { AppAction, AppActionFactory } from './app-state-actions';
|
||||||
import { Overlap } from '../common/bible-reference';
|
import { Overlap } from '../common/bible-reference';
|
||||||
import { CardType } from '../models/app-state';
|
import { CardType, SavedPage } from '../models/app-state';
|
||||||
|
import { IStorable, Storable } from '../models/storable';
|
||||||
|
|
||||||
describe('AppService Reducer', () => {
|
describe('AppService Reducer', () => {
|
||||||
const preState = {
|
const preState = {
|
||||||
@ -231,4 +232,45 @@ describe('AppService Reducer', () => {
|
|||||||
expect(testState6.cards.length).toBe(3, 'Failed to add third card');
|
expect(testState6.cards.length).toBe(3, 'Failed to add third card');
|
||||||
expect(testState6.cards[0]).toBe(card3, 'Failed to insert card at start of the list');
|
expect(testState6.cards[0]).toBe(card3, 'Failed to insert card at start of the list');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('UPDATE_AUTOCOMPLETE', () => {
|
||||||
|
const words = ['word1', 'word2', 'word3'];
|
||||||
|
|
||||||
|
const action = AppActionFactory.newUpdateAutocomplete(words);
|
||||||
|
const testState = reducer(preState, action);
|
||||||
|
expect(testState.autocomplete).toEqual(words, 'Failed to update the autocomplete array');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('UPDATE_SAVED_PAGES', () => {
|
||||||
|
const savedPages = new Storable<readonly SavedPage[]>([
|
||||||
|
{
|
||||||
|
queries: [
|
||||||
|
{
|
||||||
|
qry: 'H123',
|
||||||
|
data: null,
|
||||||
|
type: CardType.Strongs,
|
||||||
|
dict: 'H',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
qry: 'G123',
|
||||||
|
data: null,
|
||||||
|
type: CardType.Strongs,
|
||||||
|
dict: 'G',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// tslint:disable-next-line: quotemark
|
||||||
|
title: "Jason's Page",
|
||||||
|
id: 'myid',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const action = AppActionFactory.newUpdateSavedPages(savedPages);
|
||||||
|
const testState = reducer(preState, action);
|
||||||
|
expect(testState.savedPages).toBe(savedPages, 'Failed to update the savedPages array');
|
||||||
|
expect(testState.savedPages.value.length).toBe(1, 'Updated savedPages is the wrong length');
|
||||||
|
expect(testState.savedPages.value[0].queries.length).toBe(
|
||||||
|
1,
|
||||||
|
'Updated savedPages first object has the wrong number of queries'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -196,7 +196,7 @@ export class AppService extends createStateService(reducer, initialState) {
|
|||||||
const card = {
|
const card = {
|
||||||
qry: `${d}${strongsNumber}`,
|
qry: `${d}${strongsNumber}`,
|
||||||
dict: d,
|
dict: d,
|
||||||
type: CardType.Word,
|
type: CardType.Strongs,
|
||||||
data: result,
|
data: result,
|
||||||
};
|
};
|
||||||
return card;
|
return card;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user