mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-23 07:19:50 -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) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
basePath: "",
|
||||
frameworks: ["jasmine", "@angular-devkit/build-angular"],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
require("karma-jasmine"),
|
||||
require("karma-chrome-launcher"),
|
||||
require("karma-jasmine-html-reporter"),
|
||||
require("karma-coverage-istanbul-reporter"),
|
||||
require("@angular-devkit/build-angular/plugins/karma"),
|
||||
],
|
||||
client: {
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
clearContext: false, // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
dir: require('path').join(__dirname, './coverage/db'),
|
||||
reports: ['html', 'lcovonly', 'text-summary'],
|
||||
fixWebpackSourcePaths: true
|
||||
dir: require("path").join(__dirname, "./coverage/db"),
|
||||
reports: ["html", "lcovonly", "text-summary"],
|
||||
fixWebpackSourcePaths: true,
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
reporters: ["progress", "kjhtml"],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
logLevel: config.LOG_WARN,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
browsers: ["Chrome"],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true
|
||||
restartOnFileChange: true,
|
||||
});
|
||||
};
|
||||
|
@ -26,8 +26,7 @@
|
||||
|
||||
<p
|
||||
[ngClass]="{
|
||||
'as-inline':
|
||||
(showParagraphs$ | async) === (false | null | undefined)
|
||||
'as-inline': (showParagraphs$ | async) === false
|
||||
}"
|
||||
>
|
||||
<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 { AppService } from '../../../../services/app.service';
|
||||
import { CardComponent } from '../../../../common/components/card.component';
|
||||
@ -11,7 +11,7 @@ import { StrongsModalComponent } from '../modal/strongs-modal.component';
|
||||
styleUrls: ['./strongs-card.component.scss'],
|
||||
preserveWhitespaces: true,
|
||||
})
|
||||
export class StrongsCardComponent extends CardComponent {
|
||||
export class StrongsCardComponent extends CardComponent implements OnInit {
|
||||
asModal = false;
|
||||
@ViewChild('strongs') strongsElement: ElementRef;
|
||||
|
||||
@ -24,6 +24,9 @@ export class StrongsCardComponent extends CardComponent {
|
||||
})
|
||||
);
|
||||
}
|
||||
ngOnInit(): void {
|
||||
console.log(this.cardItem);
|
||||
}
|
||||
|
||||
copy() {
|
||||
const html = this.strongsElement.nativeElement.innerHTML;
|
||||
|
@ -2,7 +2,8 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { reducer } from './app-state-reducer';
|
||||
import { AppAction, AppActionFactory } from './app-state-actions';
|
||||
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', () => {
|
||||
const preState = {
|
||||
@ -231,4 +232,45 @@ describe('AppService Reducer', () => {
|
||||
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');
|
||||
});
|
||||
|
||||
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 = {
|
||||
qry: `${d}${strongsNumber}`,
|
||||
dict: d,
|
||||
type: CardType.Word,
|
||||
type: CardType.Strongs,
|
||||
data: result,
|
||||
};
|
||||
return card;
|
||||
|
Loading…
x
Reference in New Issue
Block a user