Add tests for canLearnTalent and canUnlearnTalent
This commit is contained in:
@@ -4,11 +4,14 @@ import { TalentTree } from './TalentTree'
|
||||
import {
|
||||
modifyTalentPoint,
|
||||
calcAvailablePoints,
|
||||
encodeKnownTalents
|
||||
encodeKnownTalents,
|
||||
SORT_TALENTS_BY_SPEC
|
||||
} from '../lib/tree'
|
||||
import { talentsBySpec } from '../data/talents'
|
||||
import { talentsBySpec, talentsById } from '../data/talents'
|
||||
import { classByName } from '../data/classes'
|
||||
import { History } from 'history'
|
||||
import { spells } from '../data/spells'
|
||||
import { debugPrintKnown } from '../lib/debug'
|
||||
|
||||
interface Props {
|
||||
selectedClass: string
|
||||
@@ -56,13 +59,16 @@ export class Calculator extends React.PureComponent<Props> {
|
||||
|
||||
handleTalentPress = (specId: number, talentId: number, modifier: 1 | -1) => {
|
||||
const talent = talentsBySpec[specId][talentId]
|
||||
console.log('Clicked talent: ' + talentId)
|
||||
console.log('Clicked talent: ', talentId)
|
||||
|
||||
const newKnownTalents = modifyTalentPoint(this.state.knownTalents, talent, modifier)
|
||||
if (newKnownTalents !== this.state.knownTalents) {
|
||||
this.updateURL(newKnownTalents)
|
||||
}
|
||||
this.setState({ knownTalents: newKnownTalents })
|
||||
|
||||
// Debug
|
||||
debugPrintKnown(newKnownTalents)
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -93,7 +99,8 @@ export class Calculator extends React.PureComponent<Props> {
|
||||
<ul>
|
||||
<li><a href="/shaman/-5505000055523051-55">Shaman test</a></li>
|
||||
<li><a href="/shaman/-5595000055523051-55">Shaman test broken</a></li>
|
||||
<li><a href="/rogue/-005055-50205302332212051">Rogue can unlearn first row</a></li>
|
||||
<li><a href="/rogue/-005055-50205302332212051">Rogue (should break, does not meet requirement)</a></li>
|
||||
<li><a href="/rogue/-005055-50205302333212041">Rogue can unlearn first row AND dependency</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user