Commit Graph

326 Commits

Author SHA1 Message Date
Gabriel Horner
784ad7cce3 Add unit tests for create-if-not-exists and misc test improvements
- Added unit test as it is used by several handlers
- Fixed test suite failing from last commit now that a test fs is used
- Fixed test stat implementation
- Extracted out Plugin schema to make usage of it less impl dependent
- Made test.helper alias consistent
- Made async testing consistent for export-test
2022-10-17 10:13:27 -04:00
Gabriel Horner
c8cda90373 Fix plugin install bugs and add plugin-config tests
- Add validation for plugins.edn with malli
- Add bb task using malli schema
- Add first async test that interacts with frontend.fs
- Add test helpers to make future async testing easier
2022-10-17 10:13:27 -04:00
Junyi Du
99dc9c371c test: double queare bracket in title 2022-10-16 12:17:11 +08:00
Charlie
d53ac94bfc Enhance/pdf improvements (#6475)
Full-text search, highlights and assets alias support 
It also exposes a plugin API for highlight context menu   
    ```ts
    /**
       * Current it's only available for pdf viewer
       * @param label - displayed name of command
       * @param action - callback for the clickable item
       * @param opts - clearSelection: clear highlight selection when callback invoked
       */
      registerHighlightContextMenuItem: (
        label: string,
        action: SimpleCommandCallback,
        opts?: {
          clearSelection: boolean
        }
      ) => unknown
    ```
2022-10-09 20:44:18 +08:00
Junyi Du
0e4037ab61 Feat: new file name escaping rules (#6134)
* feat: new file name escaping for namespace

feat: new file name decoding back to page name

* test: file name sanitization

feat: use _0x to encode %

feat: don't create title property

test: extra URL encoding for escaped file names

fix: fit pdf prefix into new file name rules

fix: encoding rules on some characters

fix: handle the buggy file names imported by users

fix: pdf block ref failed to jump

fix: #6167

* fix: enhance backward compatibility

chore: title validation

test: fix namespace queries test

chore: use index version stored in config.edn instead of search.versions

* feat: convert old version graph mechanism

ui: file conversion UI

feat: rename files for conversion

feat: don't trigger conversion when title property is manually edited

fix: file conflict notification while renaming files on some OS

feat: re-index on update version

feat: clicking NO in the re-index dialog would update the index-ver flag to suppress the dialog

feat: use html entities for reserved char escaping

dev: remove unresolved vars & minor refactor

chore: move file name sanity from gp-util to fs-util, as it's for encoding only but not parsing

test: update file name tests to html entities rule

test: convert files from dir ver 3 for repo_tests

feat: convert Windows reserved file names

fix: save index version into idb instead of file

fix: decode uri of path while parsing files on mobile

fix: couple dir version and index version to ensure only re-index on converted dirs

feat: go back to url-encode for special chars

* chore: fix lint

chore: improve codebase to address Gabriel's comments

fix: remove file remnants on add conflict

fix: remove file remnants on rename conflict

chore: add test ns to nbb runner

Also fix typoed fn and remove unused code

* fix: issues of rebase PR6134 to master after file-sync merged

* feat: switchable filename format

* fix: use  go block to replace promesa for rename all with blocking

* feat: re-index after apply rename all

* ui: file conversion enhancement

* fix: merging filename format PR with master

* fix: filename format lint & CI

* ui: filename format flow

* fix: error handling on the rare internal file path confliction case

* chore: shorten component code for files-breaking-changed

* chore: fix CI

* Minor fixes per latest code review

- Remove unused page-name-order
- Update catch usage to be consistent with what's on master
- Place state fn in right place
- Wording fixes:
  - select and apply -> manual. There are no checkboxes for the user
  - Update -> Edit. We use edit for all other settings button
  - Alternatives to starting sentences with May. Not a common way to
    start a sentence
  - update outdated template comment

* ux: rename instruction update

* ux: rename instruction update (2)

* Tweak wording of conversion modal

Simplifed first paragraph and explained the page to the user in first
sentence, may isn't a common way to start sentences and updated outdated
wording

* Fix large-var warning by splitting out a piece of component

* fix: right slash on Windows; legacy format file sanitization

* fix: triple lowbar renaming fns

Co-authored-by: Gabriel Horner <gabriel@logseq.com>
2022-10-08 15:47:45 +08:00
Gabriel Horner
1f0e22275d Add ns docstrings for most ns in src/main
- Added to CI now that it passes
- Added no-doc for docstrings that don't add any more than what's in the
ns name or for ones where I didn't know the ns that well
2022-09-27 13:55:16 +08:00
Gabriel Horner
9d9e976b8c Merge branch 'master' into refactor/refs-from-property-values 2022-09-21 15:34:47 -04:00
Gabriel Horner
91d6d14720 Fix sort-by not working for blocks
- Also add sort-by support for pages which fixes #5643
- Add sort-by tests
- Fix sample producing weird queries e.g. mixed block and page clauses
- Clean up last, hard to read test setup in query-dsl
2022-09-20 12:20:17 -04:00
Tienson Qin
585e0dbf9d Merge branch 'master' into refactor/refs-from-property-values 2022-09-14 22:25:09 +08:00
sallto
20542700a5 fix: Date sorting is nonsensical #6363 (#6596)
* fix: Date sorting nonsensical
* simplify normalize-block
* adjusted handling of sets and added tests

Co-authored-by: Junyi Du <junyidu.cn@gmail.com>
2022-09-14 22:13:58 +08:00
Tienson Qin
9e2d6e7cfb fix: page refs 2022-09-09 12:37:57 +08:00
Tienson Qin
336fa578d5 refactor: replace directives(front matter or org) with properties 2022-09-09 12:37:55 +08:00
rcmerci
4f3d26c2ca fix: FileMetadata, <get-local-files-meta, <get-local-all-files-meta 2022-09-06 20:27:16 +08:00
Tienson Qin
cc66195b58 fix: remove monitor-dirs 2022-09-03 19:31:17 +08:00
Charlie
01d879c18e feat!: File Sync (#5355)
- file sync for electron/ios/android
- age encryption of both file content and file path
- massive UI enhancement
- corresponding CI tasks

Co-authored-by: llcc <lzhes43@gmail.com>
Co-authored-by: rcmerci <rcmerci@gmail.com>
Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
Co-authored-by: Andelf <andelf@gmail.com>
Co-authored-by: Gabriel Horner <gabriel@logseq.com>
2022-09-01 00:31:49 +08:00
Junyi Du
8dfa8dfb49 fix: CJK hashtag update failure 2022-08-25 22:07:09 +08:00
Gabriel Horner
55ccc2d17c Rename config to :rich-property-values?
Name should allow for additional functionality later
2022-08-23 09:55:15 -04:00
Gabriel Horner
39b43b363c Fix page-properties bug and dsl-query bug
parser test caught page properties bug and dsl-query tests once written
correctly exposed another bug. Also remove unit test as they are
replaced by integration style tests in graph-parser-test
2022-08-11 16:32:00 -04:00
Gabriel Horner
0301fd3173 Print log messages and setup custom test runner
Got tired of getting bit by catch statements and no logging printing.
Moved frontend to a custom test runner as we may eventually need the
node-test-runner for other apps/builds
2022-08-11 16:32:00 -04:00
Gabriel Horner
0719163d30 Split out parse-property for use in dsl-query and tests
- Add tests for all *property dsl queries with and without new
  config option
- Add tests for property persistence
- Add tests for property relationships
2022-08-11 16:32:00 -04:00
Gabriel Horner
405183db09 Add config option to allow for more free text in property values
Still need to test that *property operators work correctly when this
option is on
2022-08-11 16:32:00 -04:00
Phoenix Eliot
bb199c4de5 Fix wrapped-by? utility function
Improve readability of test failures, add more unit tests
2022-08-11 22:58:51 +08:00
Tienson Qin
eeb827a1d3 fix: performance degrading for nested linked references
Fix #6316.

This commit also fixed the issue that toggle block children doesn't
work sometimes.
2022-08-11 16:38:00 +08:00
Andelf
52b7a5e203 test(e2e): add test case page name
fix: lint
2022-08-08 13:34:47 +08:00
Tienson Qin
b6be007d98 fix: don't replace _ for the page name if it's not a local asset 2022-08-08 13:34:47 +08:00
Gabriel Horner
8be0deecd0 Move markdown property colons into a var 2022-08-04 17:25:29 +08:00
Gabriel Horner
b66ec9cd9f Add tests to confirm property completion fix
Move current-line to specific clause for performance as fn is run on every keystroke
2022-08-04 13:43:10 +08:00
Tienson Qin
a1ca6820df Fix: broken linked references (#6105)
* enhance: clicking the refresh button if a query is slow

* fix: skip running slow queries if there's no need to refresh

* fix: linked reference filtering does not work on TASK items

close #1669

* fix: each block should have its own page as a reference when query page references

* fix: references

* fix: non consecutive blocks in query result and filtered linked references

* simplify filters logic

* fix: ref numbers

* Save both :block/refs and :block/path-refs for different usage

* fix: block refs

* enhance: move scheduled and deadlines to its own ns

* linked references performance tweaks

* mouse hover filters icon to expand the collapsed linked refs

* perf: react/refresh! once instead twice

* enhance: compute flashcards every hour instead of every 5s

* feat: macros as blocks

* feat: flashcards list

* fix: refed pages count

* fix: can't select in linked references

* fix: block editing on linked refs

* perf: editing in linked references

* enhance: update srs cards number when clicking flashcards

* Add a test for the case fixed in #6100

* Address feedbacks from Gabriel

* fix: Block Ref Indicator is missing from the references-blocks class

close #5375

* fix: referenced pages

* fix: page refs

* fix: Using filters pushed the title property to the second block

close #5845

Co-authored-by: Gabriel Horner <gabriel@logseq.com>
2022-08-04 13:03:12 +08:00
8N9KT
b7cd440144 fix private functions test 2022-07-28 18:35:56 +02:00
8N9KT
7d6ecdf645 add test remove-links-for-each-level-of-the-namespaces 2022-07-28 15:27:59 +02:00
Gabriel Horner
6a64cdf4b3 Fix tag completion at start of line or whitespace before cursor 2022-07-26 20:47:36 +08:00
Gabriel Horner
bc69e7d5a1 Silence noisy parsing tests
Added :verbose option to repo-handler/parse-files-and-load-to-db!
2022-07-26 20:47:36 +08:00
Gabriel Horner
5f8a4ed0bf Don't autocomplete tags within backtick Fix #6135
Also fix autocompleting while cursor is part of a word
2022-07-26 20:47:36 +08:00
Gabriel Horner
f5bc4c12bd Remove stray :focus test flag 2022-07-25 13:53:27 -04:00
8N9KT
66108ac9e4 add test for get-pages-that-mentioned-page
- add test for get-pages-that-mentioned-page with show-journal paramenter
- comment deleted
2022-07-25 17:55:42 +02:00
Martin Scott
1d0fa763a5 Revised format directives and mixed number format
Also changed output of non-decimal numbers to use base prefixes.
2022-07-19 10:25:26 +01:00
Martin Scott
7c11de885b Add fraction display mode
Support for showing results as fractions (mixed numbers or improper) and entering mixed numbers.
2022-07-18 01:04:48 +01:00
Martin Scott
a4b79ffe4f Fix tests
Compare output strings based on input lines.
2022-07-18 00:49:59 +01:00
Martin Scott
70c04e34bf Add operations, display formats, constants and bases
New operations:
- factorial operator `!`;
- modulo operator `mod`.

Constants added:
- `PI`
- `E`

New display format controls:
- `:fix <places>` display format;
- `:sci <places>` display format;
- `:norm <display-precision>` display format;
- `:hex`, `:oct`, `:bin` and`:dec` display formats.

New number formats:
- Enter hexadecimal, octal and binary numbers using `0x`, `0o` and `0b` prefixes respectively.

Bugs fixed:
- Loss of precision when supplying numbers in scientific notation.
2022-07-15 19:46:32 +01:00
playerofgames
8e2aa8415c Calculator: bug fixes for issue #5917, and feature additions (#5918)
* Calculator: bug fixes and feature additions

- Fix order of operations for negation and exponentiation;
- Support non-integer powers;
- Improve number parsing;
- Support comments;
- Add maths functions;
- More permissive variable naming;
- Store last result in 'last' variable.

* Fix lint warning

* Preserve last value across comments and empty lines

* Fix lint warning

* Use BigNumber operations to maintain precision

* Add conditional around pow call

* Split up long test

* Remove duplicate tests
2022-07-07 09:38:37 -04:00
Tienson Qin
139075e679 fix: suggestions from gabriel 2022-07-07 01:42:16 +08:00
Tienson Qin
ecb2024c14 fix: lint warnings 2022-07-07 01:42:16 +08:00
Tienson Qin
49acb54178 feat: add properties as linked references 2022-07-07 01:42:16 +08:00
Jonas Diemer
385113f535 Adding tests for rounding errors 2022-07-06 19:55:49 +08:00
Tienson Qin
ec8109f8d0 Add more outliner core tests 2022-06-16 07:29:07 +08:00
Tienson Qin
58bf6ee640 fix: random block could be empty 2022-06-15 15:47:23 +08:00
Tienson Qin
a88a3c0405 fix: outliner core failed tests 2022-06-15 15:38:40 +08:00
Gabriel Horner
17d2462343 Move rules into db dep as it's useful for external apps
- rules is already used by logseq-query and will be useful for
  nbb-logseq
- Updated db jobs to run in deps/db by default. Less typing but
  more importantly discourages independent libraries from depending on
  external scripts.
- Moved lint-rules task into db since it is db specific now
- Also remove nbb-logseq from top-level as all nbb compatibility is in
  deps.
2022-06-10 15:39:11 +08:00
Gabriel Horner
6608537909 Move logseq.graph-parser.db* namespaces to their own dep
Also add its own CI file
2022-06-10 15:39:11 +08:00
Tienson Qin
f4f1ff1ba2 fix: outdent blocks and re-enable outliner tests
related to #5604
2022-06-08 13:06:10 +08:00