Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Persist): add depth structure #34

Merged
merged 16 commits into from
Jan 24, 2019
Merged

feat(Persist): add depth structure #34

merged 16 commits into from
Jan 24, 2019

Conversation

daybrush
Copy link
Member

#33

@daybrush daybrush requested a review from jongmoon January 23, 2019 12:27
@coveralls
Copy link

coveralls commented Jan 23, 2019

Coverage Status

Coverage increased (+0.7%) to 93.586% when pulling b3be8a5 on younkue:depth into 814ec8a on naver:master.

Copy link

@jongmoon jongmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to common storageKey in setStateByKey

@@ -56,45 +85,6 @@ describe("Persist", function() {
location.hash = "";
sessionStorage.clear();
});
it("save number, get number(excludeHash: true)", () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed i thnk

const length4 = StorageManager.getStateByKey(CONST_PERSIST_STATE, CONST_DEPTHS).length;
const currentUrl4 = StorageManager.getStateByKey(CONST_PERSIST_STATE, CONST_CURRENT_URL);

expect(value1).to.be.equals(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Then

expect(length2).to.be.equals(2);
expect(currentUrl2.lastIndexOf("a")).to.be.equals(currentUrl2.length - 1);

expect(value3).to.be.equals(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think expect(value3).to.be.equals(value1); also meaningful test.

expect(length3).to.be.equals(2);
expect(currentUrl3.lastIndexOf(pathname)).to.be.equals(currentUrl1.length - pathname.length);

expect(value4).to.be.equals(2);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(value3).to.be.equals(value2);

src/Persist.js Outdated
StorageManager.setStateByKey(CONST_PERSIST_STATE, CONST_CURRENT_URL, currentUrl);
}
} else {
const current = StorageManager.getStateByKey(CONST_PERSIST_STATE, CONST_CURRENT_URL);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current is differ from prevUrl?

src/utils.js Outdated
function getUrl() {
return location.href.split("#")[0];
}
function getKey(name) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getStorageKey would be better.

src/Persist.js Outdated
@@ -33,28 +104,29 @@ function setRec(obj, path, value) {
class Persist {
static VERSION = "#__VERSION__#";
static StorageManager = StorageManager;
static url = "";
static [CONST_CURRENT_URL] = "";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array is intended?

src/Persist.js Outdated
StorageManager.reset(CONST_PERSIST_STATE, null);

Persist.url = "";
Persist[CONST_CURRENT_URL] = "";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest

  1. Persist.url => CURRENT_URL
  2. Persist.url => LAST_SET_URL


describe("StorageManager", function() {
describe("reset when initialize", function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Younkue It should be needed


// Then
expect(isBackForwardNavigated).is.not.ok;
expect(navigationType).is.equals(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test for type 0

@daybrush daybrush merged commit df6fb59 into naver:master Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants